A bit of regex help needed

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
highend
Posts: 8304
Joined: 06 Feb 2011 00:33

Re: A bit of regex help needed

Post by highend » 26 Jun 2016 05:54

I'm not sure if I understand...

When you want to capture more / less path elements, just + / - the number in {}

Regarding not capturing the last \
{ } -1 and repeat the capture group once
or just use trim($a, '\', "R");
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

tiago
Posts: 583
Joined: 14 Feb 2011 21:41

Re: A bit of regex help needed

Post by tiago » 30 Jun 2016 01:35

The point is I'm having the need of specific regexes for each case described as they are all present on single documents, so a one-for-all token-wise solution won't do.

Thank you for helping, highend.
Power-hungry user!!!

Filehero
Posts: 2292
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: A bit of regex help needed

Post by Filehero » 19 Nov 2016 08:22

I suspect some of my difficulties with XY regex seem to arise from unsupported expressions.

Is there any official documentation for the regex engine XY uses? Haven't found a link in the "major" threads this forum's search returns.

Thanks, FH

highend
Posts: 8304
Joined: 06 Feb 2011 00:33

Re: A bit of regex help needed

Post by highend » 19 Nov 2016 08:24

One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: A bit of regex help needed

Post by SkyFrontier » 21 Mar 2017 00:04

Hello, people!

How do I process this

Code: Select all

Image of The Butterfly Effect
29.
The Butterfly Effect (2004)
   
7.7/10  
Evan Treborn suffers blackouts during significant events of his life. As he grows up, he finds a way to remember these lost memories and a supernatural way to alter his life by reading his journal. (113 mins.)
Director: Eric Bress, J. Mackye Gruber
Stars: Ashton Kutcher, Amy Smart, Melora Walters, Elden Henson
Add to Watchlist
 
Image of Alice's Adventures in Wonderland
30.
Alice's Adventures in Wonderland (1972)
   
5.8/10  
Alice (Fiona Fullerton) falls down a rabbit hole and into a magical dream world populated by surreal characters and bewildering adventures... (101 mins.)
Director: William Sterling
Stars: Fiona Fullerton, Michael Jayston, Hywel Bennett, Michael Crawford
Add to Watchlist
...reducing it to:
The Butterfly Effect (2004); Alice's Adventures in Wonderland (1972)

TIA!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SammaySarkar
Posts: 4205
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: A bit of regex help needed

Post by SammaySarkar » 21 Mar 2017 06:00

Code: Select all

 $str = <<<#YOURSTRINGHERE
 #YOURSTRINGHERE;
 $filter1 = regexmatches($str, "\d+\.\r?\n.*?\r?\n", "<crlf>");
 $filter2 = regexreplace($filter1, "^\d+\.$(?:\r?\n)+(.*?)(?:\r?\n)+", "$1;");
 text $filter2;

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: A bit of regex help needed

Post by SkyFrontier » 21 Mar 2017 08:31

...never my struggle would get me there, thanks much!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SammaySarkar
Posts: 4205
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: A bit of regex help needed

Post by SammaySarkar » 21 Mar 2017 08:35

No problem. :)

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: A bit of regex help needed

Post by SkyFrontier » 19 Apr 2017 17:32

Is it possible for regex to capture and list all the variables present (clipboard) in a script?
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

highend
Posts: 8304
Joined: 06 Feb 2011 00:33

Re: A bit of regex help needed

Post by highend » 19 Apr 2017 17:46

Code: Select all

text regexmatches(<clipboard>, "\$[a-z](\w+)?\b", <crlf>);
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: A bit of regex help needed

Post by SkyFrontier » 20 Apr 2017 15:48

Perfection!
Thanks, highend!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Dustydog
Posts: 263
Joined: 13 Jun 2016 04:19

Re: A bit of regex help needed

Post by Dustydog » 27 Apr 2017 02:11

I'll put in my two cents if you'll give a complete set of test data and your desired match results.

If you provide a test data sample that, when matched, covers your problem (and doesn't cover close exceptions) - we're done. Make sure to include any context that might help or hinder a correct match.

I'd rather not assemble my own definitive test data out of a series of posts, the same with your grouping requirements or whatever, but I don't mind working on it. Ofc, highend will beat me to it and likely do a better job, but still :)

One post, all required information and definitive (but not overly redundant) test data: This will be good for you to rigorously determine yourself anyway, regardless of help.

Clarity is good.

Hope I can help - or someone beats me to it.

Post Reply