Comments (11)
- maybe it is your error - if modifierS is ON, dot finds more chars (also finds NewLine)
- give the compilable example for FreePascal
from tregexpr.
2. give the compilable example for FreePascal
function pars(n:integer;RegString : AnsiString; thmlcode: AnsiString):TStringList;
var
RegExp: TRegExpr;
begin
RegExp := TRegExpr.Create;
RegExp.ModifierS := true;
RegExp.ModifierM:=true;
RegExp.InputString := thmlcode;
RegExp.Expression := RegString;
try
try
if RegExp.Exec then
repeat
textmp.Add(RegExp.Match[n]);
until RegExp.ExecNext=false;
except
end;
finally
RegExp.Free;
end;
result:=textmp;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Base:=Tstringlist.Create;
Base.Clear;
if opendialog1.Execute then
Base.LoadFromFile(Opendialog1.FileName);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
textmp:=TStringList.Create;
memo1.lines.AddStrings(pars(1,'2:\s(.+)\s3:\s(.+)',Base.text));
freeandnil(textmp);
end;
from tregexpr.
Please attach the zip file with needed files- .lpr .pas .lfm .lpi files.
from tregexpr.
Please attach the zip file
https://dropmefiles.com/ihehD
from tregexpr.
I made Linux app now
how to see error here??
from tregexpr.
how to see error here??
No errors, parses the word incorrectly create .txt from words and openned it:
1: batman
2: lenin
3: money
4: this
from tregexpr.
lenin? Are you trolling here? maybe hitler too?
Words are not important, they are taken in guesswork
from tregexpr.
I tested on my file. I see it is OK .
if ModifierS=True, group[2] takes all text from "3: " until end of file.
if ModifierS=False, group[2] takes only one line after "3:"
Lazarus/ Linux
from tregexpr.
I tested on my file. I see it is OK .
Sorry try with this regex:
https://regex101.com/r/xSf83d/1
And This is Words in text file:
1: batman
2: lenin
3: money
4: this
1: superman
2: rabbit
3: deep
4: thanks
from tregexpr.
@Uefi1
Your Pascal code sets the modifiers S, G and M (S and G are on by default).
Your regex101 code sets the modifiers G, M and I. And not S. Add S to it, otherwise you're comparing apples with oranges.
from tregexpr.
@andgineer Seems user mis-tests the S regex modifier. seems all is OK in the code. let's close?
from tregexpr.
Related Issues (20)
- Crash with O4 HOT 3
- $DEFINE UnicodeRE off-> tests fail HOT 9
- function regNextQuick(p: PRegExprChar): PRegExprChar has problem with inline in delphi HOT 12
- Sub-call broken in loop HOT 2
- op-star prevents match HOT 5
- Delphi 12 changes HOT 2
- OP_Star / FindRepeated and group ref \1 HOT 3
- FindRepeatead and Unicode / may break OP_STAR/PLUS/... HOT 2
- OP_ANYLINEBREAK incomplete in FindRepeated
- OP_ANYLINEBREAK and FillFirstCharSet
- Optional Feature: backtracking is sub-calls HOT 5
- Nested back-ref does not work HOT 2
- Problems with DefParam and OverMeth defines in Delphi 12. HOT 6
- Add to CI matrix additional lazarus versions we want to support with
- Capture in CI benchmark and build report
- Add to CI runners to check `solaris x64` and `aarch64`
- Add to README badges with CI results
- Why test `TestBranches` takes so long? HOT 2
- Can we remove travis configs? HOT 1
- Crash when searching inside huge line (len=130K) HOT 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tregexpr.