user1820221
user1820221

Reputation: 87

Regex all characters except string

I want to select all space characters except those preceded by the string, Send,.

A look-ahead using (?!) will not work. What is another way to do this?

Upvotes: 1

Views: 702

Answers (1)

eldarerathis
eldarerathis

Reputation: 36193

Sounds like look behind should suffice. If the string Send, immediately precedes the the space you want then it would be:

(?<!Send,)\s

If the string doesn't come directly before the space then your options could depend a bit on your particular regex flavour, since many do not support variable length look behinds.

Upvotes: 3

Related Questions