Questions tagged [lookbehind]

A lookbehind is a part of the regular expression standard.

385 questions
0
votes
1 answer

RegEx that removes XHTML line breaks appearing before block-level tags

I need a RegEx that finds extraneous
tags that occur before block tags, leaving all other
tags intact. Here's the text I am searching:
some text
some more text
However, when using the…
Matt Miller
  • 1,421
  • 1
  • 15
  • 24
0
votes
2 answers

python regex with conditional lookbehind

I'm looking for substring starting with @ and ending with the first \s occurrence. It's necessary to have @ at the beginning of the string or after space. Example: @one bla bla bla @two @three@four #@five Result: @one, @two, @three@four I end up…
qubblr
  • 45
  • 4
0
votes
3 answers

How Can I Use Look-Ahead and Look-Behind to Create a Custom Boundary Matcher?

I want to split a String at the word boundaries using Scanner. Normally, this would be done like this: Scanner scanner = new Scanner(...).useDelimiter("\\b"); The problem is that my definition of "word" character is a tiny bit different from the…
rolve
  • 10,083
  • 4
  • 55
  • 75
0
votes
1 answer

Regex using Negative lookbehind and Negative lookahead assertion

Possible Duplicate: Regex matching left single quotation outside the double quotations First Note: &ldquo - left double quote (") &rdquo - right double quote (") &lsquo - left single quote (') &rsquo - right single quote (') I need to match all…
neo
  • 293
  • 3
  • 7
  • 21
0
votes
1 answer

Regex lookbehind assertion issue

this is my current regex: (?<=[\$T|\s|\p{P}|\$%\$%])sampleString I want to match all sampleString in my richtextBox and some instance of sample string in my richtextBox is something like this : $TsampleString $%$%sampleString The problem is that…
neo
  • 293
  • 3
  • 7
  • 21
0
votes
3 answers

Fixed Length Regex Required?

I have this regex that uses forward and backward look-aheads: import re re.compile(")|(?<=") I'm trying to port it from C# to Python but keep getting the error look-behind requires fixed-width pattern Is it possible…
Chad
  • 3,159
  • 4
  • 33
  • 43
0
votes
3 answers

Extract a portion of text using RegEx

I would like to extract portion of a text using a regular expression. So for example, I have an address and want to return just the number and streets and exclude the rest: 2222 Main at King Edward Vancouver BC CA But the addresses varies in format…
Jaime
  • 595
  • 1
  • 8
  • 20
-1
votes
1 answer

How to capture lookbehind using java

I am trying to capture text that is matched by lookbehind. My code : private static final String t1="first:\\\w*"; private static final String t2="(?<=\\w+)=\\".+\\""; private static final String t=t1+'|'+t2; Pattern p=Pattern.compile(t); Matcher…
Joseph
  • 17
  • 5
-1
votes
2 answers

How to extract content in between an opening and a closing bracket?

I am trying to split a string into an array of text contents which each are present within the [@ and ] delimiters. Just characters in between [@and ] are allowed to match. Being provided with a string like ... const stringA = '[@Mary James],…
Sonali
  • 3
  • 2
-1
votes
1 answer

In regular expressions What is variable-length lookbehind-assertion?

I copied a statement that aims to convert a string into Camel Case in Octave. The code is as following. function camelStr = stringcamelcase (str) camelStr = lower(str) idx = regexp([' ' camelStr], '(?<=\s+)\S', 'start') -1; camelStr(idx)…
LudgerSB
  • 1
  • 3
-1
votes
2 answers

Look-behind issue with java regex. Look-behind group does not have an obvious maximum length

I need to match sequence='999' inside a tag in a xml document using Java RegEx (xml parser is not an option). Snippet of the xml:
user2287359
  • 497
  • 1
  • 5
  • 16
-1
votes
2 answers

LookBehind - Find string occuring after a pattern

I need help regarding a regex Query :- C: - total 79.45 Gb - used: 33.82 Gb (43%) - free 45.63 Gb (57%) This is my sample text . I want to find the %usage of used disk . i.e 43% in my case . I am using lookbehind to find the occurrences after…
animo3991
  • 181
  • 2
  • 9
-1
votes
2 answers

how to match any string but not a string that starts with slash?

how to match any string but not a string that starts with a slash? I'm using node js regex that was my try but it didn't work (?!\/s).*
Engineer Passion
  • 1,051
  • 1
  • 8
  • 14
-1
votes
1 answer

JavaScript regex with positive lookbehind emulation

I am trying to create a regex that will extract the bold portion from a Flickr URL. I want the string between www.flickr.com/photos/ and /. https://www.flickr.com/photos/annaheimkreiter/14785981533/in/explore-2014-07-28 …
CodeToad
  • 4,656
  • 6
  • 41
  • 53
-1
votes
1 answer

Understanding lookbehind

I put in online testers the regular expression => .{3}(?<=USD\d{3}) and Subject string => USD100 and this returns 100. I'd like to know is how the regex engine works in this case? How the regex engine returns this 100? Regular Expression: …
1 2 3
25
26