regex instead of two crops

A swapping-ground for Regular Expression syntax

regex instead of two crops

Postby salatt » Wed Jun 27, 2012 9:16 am

Hi, i need to extract strings between '_' and '-' in names like this 39e8ded94_559590056----559590056-4518.jpg
i use crop special with -* and again with *_
Can you suggest a regex to do this in one step?
Thanks
salatt
 
Posts: 2
Joined: Wed Jun 27, 2012 9:01 am

Re: regex instead of two crops

Postby Stefan » Thu Jul 05, 2012 8:33 am

salatt wrote:Hi, i need to extract strings between '_' and '-' in names like this 39e8ded94_559590056----559590056-4518.jpg
i use crop special with -* and again with *_
Can you suggest a regex to do this in one step?
Thanks


FROM:
39e8ded94_559590056----559590056-4518.jpg
TO:
559590056.jpg
USE:
RegEx(1)
Match: _(.+?)-
Repla: \1


The important part here is the "?" for working non-greedy
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: regex instead of two crops

Postby salatt » Fri Jul 06, 2012 8:25 am

Great solution!
salatt
 
Posts: 2
Joined: Wed Jun 27, 2012 9:01 am


Return to Regular Expressions