Questions tagged [negative-lookbehind]

In regular expressions, negative lookbehind checks if the character before the current character does NOT match a certain character.

In regular expressions, negative lookbehind checks if the character before the current character does NOT match a certain character. For example, (?<!a)b matches a "b" that is not preceded by an "a", using the negative lookbehind.

207 questions
0
votes
3 answers

Javascript regexes - Lookbehind and lookahead at the same time

I am trying to create a regex in JavaScript that matches the character b if it is not preceded or followed by the character a. Apparently, JavaScript regexes don't have negative lookbehind readily implemented, making the task difficult. I came up…
osolmaz
  • 1,873
  • 2
  • 24
  • 41
0
votes
1 answer

Java RegEx API "Look-behind group does not have an obvious maximum length near index ..."

I'm on to some SQL where clause parsing and designed a working RegEx to find a column outside string literals using "Rad Software Regular Expression Desginer" which is using the .NET API. To make sure the designed RegEx works with Java too, I tested…
Foo Inc
  • 1
  • 2
0
votes
1 answer

How to match a string that doesnt contain a pattern

I am trying to write a regex template that matches all the strings that doesn't contain a certain template. E.g.: Matches: This is my friend. He is very nice. in This is my friend. He is very nice. but doesn't match anything in : This is my…
mathinvalidnik
  • 1,566
  • 10
  • 35
  • 57
0
votes
2 answers

Regex lookbehind to extract string

So I have this ugly string which I'm picking up off the wire: {"feedtype": "playlist", "base_url": "http://feeds.xhis.com/rteavgen/player/", "feed_title": "Single Item Playlist", "feedid": "playlist", "alt_url": …
Eamorr
  • 9,872
  • 34
  • 125
  • 209
0
votes
2 answers

Negative Lookbehind: Match a substring that's not preceded one of a set of characters

Question How do you define a regular expression that will match each substring that: ends a line is not preceded by one of a given set of characters Case I have a function that removes hardcoded newlines from strings of text, so they will reflow…
Carl Smith
  • 3,025
  • 24
  • 36
0
votes
1 answer

strange behavior in vim with negative look-behind

So, I am doing this search in vim: /\(\(unum\)\|\(player\)=\)\@
João Portela
  • 6,338
  • 7
  • 38
  • 51
0
votes
1 answer

Regex match website that is NOT an email

I'm trying to extract websites without matching email addresses. In other words if my contact section has email: a@gmail.com ---- website: www.company.com I want the www.company.com without matching gmail.com. So far I have tried everything that…
happygilmore
  • 3,008
  • 4
  • 23
  • 37
0
votes
1 answer

negative lookbefore for a blackslash in ruby 1.9

I want to match every '[' or ']' that's not preceded by a backslash in ruby 1.9 I tried: /?
luca
  • 12,311
  • 15
  • 70
  • 103
0
votes
1 answer

Can a negative lookbehind be used in Phing replaceregexp task?

Having tried to drop a negative lookbehind regex into a Phing replaceregexp task and receiving the error: BUILD FAILED Error reading project file [wrapped: C:\path\to\build.xml:110:29: > required] Total time: 0.4800 seconds I see that the…
A.M. D.
  • 928
  • 6
  • 10
0
votes
1 answer

RegEx Negative LookBehind in Java

I am trying to match list of string that end in .xsd but not in form.xsd I use the following regEx: ArrayList files = new ArrayList(); files.add("/abadc/asdd/wieur/file1.form.xsd"); files.add("/abadc/asdd/wieur/file2.xsd"); Pattern…
Rush
  • 35
  • 4
0
votes
1 answer

Python Regex match so long as there's no character

I am having some trouble with another regular expression. For this one, my code is supposed to look for the pattern: re.compile(r"kill(?:ed|ing|s)\D*(\d+).*?(?:men|women|children|people)?") However, it is matching too aggressively. It happens to…
hyleaus
  • 755
  • 1
  • 8
  • 21
0
votes
2 answers

Negative lookbehinds in ActionScript

Im trying to write a Regex that will match most common emoticons, but not if they are inside a link. My emoticons are :P =P :-P =-P :) :-) =) =-) :/ =/ :-/ =-/ :o =o :-o =-o :( :-( =( =-( :D :d :-D :-d =D =d =-D =-d I don't want http:// to match…
citizen conn
  • 15,300
  • 3
  • 58
  • 80
0
votes
2 answers

How to extract string within parentheses that doesn't start with specific keywords (with negative look behind assertion?)

I would like to find the string position of the (test) string from the string below (the one that neither start with for or or): • * (for test) (or test) (test) Is it possible to find the specific string using negative look behind…
tiguero
  • 11,477
  • 5
  • 43
  • 61
0
votes
1 answer

Matching a word, but not in a comment

I am trying to match a word, but not in cases where it is preceded by a comment (/* not followed by */). I've been trying to use negative lookahead assertions to accomplish this with no luck so far. Is this going to be possible with negative…
umop
  • 2,122
  • 2
  • 18
  • 22
0
votes
1 answer

Using regex to sift through source code tree to find occurrences of a function call

Rather than opening a bunch of solution files in VS2010 and then searching for occurrences / references of a function call, I'd rather just grep with a regular expression. I could do this in two passes -- first grep for all occurrences of…
Dave
  • 14,618
  • 13
  • 91
  • 145
1 2 3
13
14