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

Discuss and share scripts and script files...
Post Reply
drjs5x
Posts: 152
Joined: 18 Nov 2015 18:12
Location: Turkey

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

Post 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.
newbie or not...........

amirvf
Posts: 133
Joined: 18 Oct 2020 00:46

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

Post 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.

highend
Posts: 13316
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

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

Post 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");
One of my scripts helped you out? Please donate via Paypal

drjs5x
Posts: 152
Joined: 18 Nov 2015 18:12
Location: Turkey

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

Post by drjs5x »

thank you for help
newbie or not...........

drjs5x
Posts: 152
Joined: 18 Nov 2015 18:12
Location: Turkey

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

Post 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
newbie or not...........

highend
Posts: 13316
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

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

Post 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, ".");
One of my scripts helped you out? Please donate via Paypal

Post Reply