Search code examples
regexregex-lookaroundslookbehind

Regexp - Match any character except "Something.AnyChar"


I have a string:

Input:

"Feature.. sklsd " AND klsdjkls 9290 "Feass . lskdk SDFSD __ ksdljsklfsd" NOT "Feuas" "Feature.lskd" OR PUT klasdkljf al9- .s.a, 9a0sd90209 .a,sdklf jalkdfj al;akd


I need to match any character except OR, NOT, AND, "Feature.any_count_of_characters"

the last one is important this start with: "Feature.

This is followed by any number of characters and then ends with: " character.

I'm trying to solve this using lookahead or lookbehind but I can get the expected output, only a portion of characters that I don't want.

My expected output is

"Feature.. sklsd " AND klsdjkls 9290 "Feass . lskdk SDFSD __ ksdljsklfsd" NOT "Feuas" "Feature.lskd" OR PUT klasdkljf al9- .s.a, 9a0sd90209 .a,sdklf jalkdfj al;akd

All that is in black.

To test it i'm using these links:

http://gskinner.com/RegExr/
http://regexpal.com/

Thanks.

EDIT

Check this link http://regexr.com?37v36

inside the link i get matched some expression. But i don't need the expression that matched. i need the inverse, how i can get it?

Thanks.


Solution

  • Just use

    \s*(?:AND|OR|NOT|"[^"]+")\s*
    

    but do a replace operation. That will leave what you want.