Home > Enterprise >  Regex: How to find a string, then get charactes on either side up to a dilimeter?
Regex: How to find a string, then get charactes on either side up to a dilimeter?

Time:10-14

I have a string like so:

foobar_something_alt=\"Brownfields1.png#asset:919\" /><p>MSG participat

And wish to find all oocurrences via the substring #asset: then select the characters around the match up to the quote marks.

Trying to extract specific ALT tags from a SQL dump. Is this possible with a regular expression?

CodePudding user response:

Put [^"]* before and after the string you want to match. This will match any sequence of characters that aren't ".

[^"]*#asset:[^"]*
  • Related