Frank Vel Frank Vel - 1 year ago 40
Javascript Question

Regex: non-word-char preceded by space or at the beginning of a line

I'm trying to match

's that are preceeded by nothing or whitespace like in the following example:


My approach is
, but this captures
one two three four
only captures
. How do I get
one two
, without getting
three four

If it's relevant, all
's are succeeded by a letter.

Answer Source

How about ^\s*@ ? That is, start of line followed by zero or more whitespace then @. (Note, different laguanges have different regex rules)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download