Posted by: kielschwein | Date: 2018-06-03 22:44 | IP: IP Logged
I'm wondering, why non capturing submatches don't work (causing a "invalid RegExp" error).
Is this a bug or just a missing feature?
Posted by: pspad | Date: 2018-06-04 04:10 | IP: IP Logged
Can you give us any example of nonworking regular expression?
Have you look at PSpad help? Chapter Menu description / Search Menu / Regular epressions?
Posted by: kielschwein | Date: 2018-06-04 09:07 | IP: IP Logged
any non caturing submatch RegExp causes the error popup
"your regular expression is not correct" (in my case the text is in German).
Here my original example
but even this simple one fails
Both RegExps pass any RegExp (Tester) I've tried, like "Regex Coach", "www.regexpal.com" or "UltraEdit".
Posted by: pspad | Date: 2018-06-04 09:16 | IP: IP Logged
PSPad uses Perl syntax. Substitution is made by $n
Read please help, there are examples (F1 in search dialog should work too)
Or click on the buttons next to search or replace fields
Can you please provide sample text line and write what do you want to search?
Edited 1 time(s). Last edit at 2018-06-04 09:17 by pspad.
Posted by: pspad | Date: 2018-06-04 09:19 | IP: IP Logged
(?:\.) isn't correct expression
If you want to search for ?, you need to escape it, cause ? is control char. Same with :
Posted by: kielschwein | Date: 2018-06-04 09:31 | IP: IP Logged
Sorry, but I don't understand what you mean with
"(?:\.) isn't correct expression"
This is for sure correct and is a non capturing group subsearch for a DOT.
In fact this does work in all tested example environments besides PSPad.
Here the example:
Text to search and replace
Kaufpreis (netto) 23.648,74 €
Kaufpreis (netto) ;23648,74 €
Posted by: pspad | Date: 2018-06-04 09:45 | IP: IP Logged
search for: ^(.*)\s(\d+)\.(\d+)(.*)
replace: $1 ;$2$3$4
Posted by: kielschwein | Date: 2018-06-04 10:06 | IP: IP Logged
The issue/my issue is simple that I'm often using complex search/replacement strings and just want to use non capturing subpatterns (to minimze the number of capture groups.
As non capturing groups are part of the PCRE implmentation, I was just wondering, why they don't work in PSPad.
The issue is not just the mentioned example (which does not only search/replace the one supplied text) but a complete set of lines
Posted by: pspad | Date: 2018-06-04 10:24 | IP: IP Logged
OK. Change your search expression to: (.*?\s)(\d+)(\.)*(\d+)(,)*(\d+\s)(€|kWh|Cent)
I don't understand this part in your expression: (?:\.)
What do you meant with this one?
Posted by: kielschwein | Date: 2018-06-04 10:41 | IP: IP Logged
(?:...) is a non-capturing group, which groups multiple tokes together without creating a capture group
In my case,
means, search for a DOT as group subpattern, but don't capture it
For details see the following article
Edited 2 time(s). Last edit at 2018-06-04 10:46 by kielschwein.