Alexey-T / CudaText

Cross-platform text editor, written in Free Pascal
Mozilla Public License 2.0
2.39k stars 166 forks source link

Regular Expression gives the error (it is OK) #5576

Closed LeeMSilver closed 6 days ago

LeeMSilver commented 1 week ago

In the attached zip-file 1.png shows a code-snippet wherein I'm searching for the following RE: ((\w+\.cs)" ). 2.png shows the error generated. Note that this works in SynWrite and other editors.

Cuda-RE.zip

Alexey-T commented 1 week ago

hm, strange, I cannot repro the error. my example text:

"bbb.cs" "eee.cs" dd

regex: ((\w+\.cs)" )

and it finds it OK:

Screenshot from 2024-06-24 12-22-44

find-next gives:

Screenshot from 2024-06-24 12-22-53

@miroslavmatas Do you see the error?

Alexey-T commented 1 week ago

what you can try now, it to remove outer brackets (), and inner brackets are not needed too. and better replace space with \x20 (AFAIR, spaces are ignored in regex).

regex will be: (\w+\.cs)"\x20

MiroslavMatas commented 6 days ago

@MiroslavMatas Do you see the error?

works fine here, no error

LeeMSilver commented 6 days ago

I just retried it on a different xml-file and it works as expected - strange, as I got the reported error multiple times before I reported it.

Note: the parens were needed as I was doing a regex replace, but the problem was only on the 'find' part.

It looks like you can close this issue.