Regex match until a comma

suklee

Diamond Member
Oct 9, 1999
4,575
10
81
I have a SQL dump of content, and I'm trying to fix these links to image popups.

I am using Textmate and figured regex would be the best way.

Basically I want to change this:

jpg&title=o2_xda_atom_crystal_case.jpg&mode=basic&imgwidth=320&imgheight=480&print=0&save=0\',\'Popup

into this:

jpg\',\'Popup

How can I quickly match everything from "jpg" until I get to a \', ?
 

PhatoseAlpha

Platinum Member
Apr 10, 2005
2,131
21
81
Ah, I see, you didn't want the jpg in the match, is that the problem?

(?<=jpg).*(?=\\')

Should match 0 or more characters, but as few as possible, that are proceeded by jpg and followed by \'