I\'m having trouble getting this Javascript Regular Expression to work.
What i want is to find a character that starts with @\"
has any characters in the middle
Try this regular expression:
/@(["'])[^]*?\1/g
An explanation:
@(["'])
matches either @"
or @'
[^]*?
matches any arbitrary character ([^]
contains all characters in opposite to .
that doesn’t contain line-breaks), but in a non-greedy manner\1
matches the same character as matches with (["'])
Using the literal RegExp syntax /…/ is more convenient. Note that this doesn’t escape sequences like \"
into account.