Questions tagged [lookbehind]

A lookbehind is a part of the regular expression standard.

385 questions
0
votes
1 answer

PCRE Regex : how to combine lookahead for following purpose?

I am trying to clean log files to categorize them in Splunk, so my question is: (?i)^(?:[^ ]* ){8}(?P.+)((?=\d{8}\d{8}\d{10}.)|(?=\d{8}.?)) bold area needs to be combined like if/else,[it selects good before bold lines] I want it to STOP just before…
akemko
  • 55
  • 10
0
votes
3 answers

What is wrong with this regex lookahead?

I have lines that start with a number followed by a space, a key and then the value. I need only the value. The problem is that my regex returns the HOLE line instead of only the value. lines example: 1 NAME Bob /Cox/ 1 SEX M 1 FAMS…
0
votes
2 answers

Variable length Lookbehinds RegEx don't works in Python

I want extract the text between ':' and '|' characters, but in second and third data there are a space after the ':' The intput: Referencia:22726| Referencia Cliente Ak: 233726 | Referencia histórica: 256726 | Suelo | AGOLADA (Pontevedra) - CARPAZO…
Trimax
  • 2,413
  • 7
  • 35
  • 59
0
votes
2 answers

regex carry look behind ip adress

Is there a regex, which will read and return the ip address in proper format in this text? Note it's backward, so the regex would have to step through the code backwards then replace '|' with '.' It's been driving me crazy... and I'd appreciate your…
user2957951
  • 303
  • 2
  • 4
  • 11
0
votes
3 answers

Negative lookbehind Regex in Numbers?

I'm trying to find numbers before image extensions (jpg|jpeg|png|bmp|gif|tif). But I want to exclude them if there's an NUMBERSxNUMBERS pattern. My expression is: (?!\dx\d)[0-9]{1,}.(jpg|jpeg|png|bmp|gif|tif) ●The text is found in long links like…
Sam-Bo
  • 779
  • 1
  • 7
  • 11
0
votes
2 answers

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,…
Pablo Pantaleon
  • 1,506
  • 1
  • 19
  • 38
0
votes
2 answers

whitespaces inside positive lookbehind regex

wont work, how to fix this problem? I need to get the number. Foo can bee with space or without space. (?<=Foo:\s?).+\d Foo:2013
Bar: Foo: 2013
Bar:
atako katukas
  • 21
  • 1
  • 8
0
votes
1 answer

In Vb how to add look behind in Regular Expression

As per my requirement i need to check three conditions using regular expression. 'Find the dot position dotPos = InStr(editFormat, ".") 'Find whole number of digits wholeNum = Left$(editFormat, dotPos - 1) 'Find decimal number of digits decNum =…
prakasam k
  • 89
  • 3
  • 11
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
2 answers

How do I perform this regex in order to extract the value of the variable

You can test everything out here: I would like to extract the value of individual variables paying attention to the different ways they have been defined. For example, for dtime we want to extract 0.004. It also has to be able to interpret…
Isopycnal Oscillation
  • 3,234
  • 6
  • 21
  • 37
0
votes
1 answer

Javascript regex with lookahead and lookbehind being wrong?

I'm using the following regex to match the word 'stores' between '/' and '?' with a possible forward slash '/' before the '?' but for some reason it fails saying there's an invalid quantifier. Any idea why it might be wrong and quatifier is that? I…
GGets
  • 416
  • 6
  • 19
0
votes
3 answers

How to use lookbehind or lookahead and replace the matched string?

I am stuck at one more RegEx. Sample input : project description I want to write RegEx. that if word "description" is found and its preceded by word "project" then prepend "project description" with "". expected output : project…
Shekhar
  • 11,438
  • 36
  • 130
  • 186
0
votes
2 answers

Returning only the first match using Regex Look-Behinds

Given the following XML document: How can I return the first /> using Regex? So far I've been able to get pretty…
mclark1129
  • 7,532
  • 5
  • 48
  • 84
0
votes
1 answer

Regex Match NC-Comments in a string with mixed C#-Code

I have a textfile with mixed NC-Code and C#-Code. C#-Code starts with "<#" and ends with "#>". Now I need one regex expression to find all NC-Comments. One problem is that NC-Comments starts with ";" therefore I got some issues to distinguish…
user1579585
  • 55
  • 1
  • 6
0
votes
1 answer

Positive lookbehind with a matching group to be extracted

testString = ("

Tricks

" "") import re re.sub("(?<=[

(.+?)

\s+])", "{{ \\1 @ \\2 }}", testString) This produces: invalid…
tomsseisums
  • 13,168
  • 19
  • 83
  • 145