Page 1 of 1

dont work regex (?<=_)(.*?)(?=\.) etc...

Posted: 08 Nov 2020 20:47
by drjs5x
hi dear coders


text regexmatches("04_20200814_13.00.00-14.00.00[H][@42fe2][0]+++13,49++.avi", "(?<=_)(.*?)(?=\.)");

i want to get text "20200814_13" ...
error result.


but regex good work in EditPadPro7 etc.

please help me.

Re: dont work regex (?<=_)(.*?)(?=\.) etc...

Posted: 08 Nov 2020 21:00
by amirvf
drjs5x wrote: 08 Nov 2020 20:47 hi dear coders


text regexmatches("04_20200814_13.00.00-14.00.00[H][@42fe2][0]+++13,49++.avi", "(?<=_)(.*?)(?=\.)");

i want to get text "20200814_13" ...
error result.


but regex good work in EditPadPro7 etc.

please help me.
At the moment Regex library in XYplorer is based on Visual Basic Regex and it does not support lookbehind.

Re: dont work regex (?<=_)(.*?)(?=\.) etc...

Posted: 08 Nov 2020 21:01
by highend

Code: Select all

text regexreplace("04_20200814_13.00.00-14.00.00[H][@42fe2][0]+++13,49++.avi", "^\d+_(\d+_\d+).*", "$1");

Re: dont work regex (?<=_)(.*?)(?=\.) etc...

Posted: 08 Nov 2020 21:14
by drjs5x
thank you for help

Re: dont work regex (?<=_)(.*?)(?=\.) etc...

Posted: 08 Nov 2020 21:48
by drjs5x
yes but mixed format digits letters combined formats? solution?
"0dfdg0_20200814_13.gdg00.00-1dgdg4.00.00[H][@42fe2][0]+++13,49++.avi"
how get text "20200814_13" ?


Sincerely

Re: dont work regex (?<=_)(.*?)(?=\.) etc...

Posted: 08 Nov 2020 21:56
by highend
You know a lookbehind but not a simple pattern to capture a-z and 0-9? oO

Code: Select all

text regexreplace("0dfdg0_20200814_13.gdg00.00-1dgdg4.00.00[H][@42fe2][0]+++13,49++.avi", "^[a-z0-9]+_(\d+_\d+).*", "$1");
You wouldn't even need regexreplace() or regexmatches()...

Code: Select all

text gettoken(gettoken("0dfdg0_20200814_13.gdg00.00-1dgdg4.00.00[H][@42fe2][0]+++13,49++.avi", 2, "_", , 2), 1, ".");