Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 19 results for
lookbehind
- Page 1
Search for bytes that are located before a set of found bytes
Programming
Software Development
6 Years Ago
by random_1
… only works with int right? then i saw `lookahead` and `
lookbehind
` but i don't understand the docs. any help will…
negative lookbehind regex problem
Programming
Software Development
12 Years Ago
by diafol
Hi all, am using a regex (in php), but I'm all confused. I'm trying to replace a string ('di') with 'deu'. SImple enough, but I don't want a replacement if 'di' is preceded by 'io' as in 'iodine', 'iodic', 'iodide' etc. This is what I have: [CODE]'/(?<!io)di/i'[/CODE] It works fine for everything, but unfortunately it doesn't stop the 'iodi'…
Re: negative lookbehind regex problem
Programming
Software Development
12 Years Ago
by d5e5
Rather than struggle to compose one regex that does all the substitution I would use two regexes. I find it easier to understand and change if necessary.[CODE]#!/usr/bin/perl use strict; use warnings; my @words = qw(iodine Thiodi number dix Iodic iodide); foreach my $word(@words){ $word =~ s/(?<!io)di/deu/i;#Replace di with deu …
Re: negative lookbehind regex problem
Programming
Software Development
12 Years Ago
by diafol
Thanks d5e5, I'll give it a go. I'll need to change code to php but looks strightforward. Will get back to you.
Shorten a regex lookahead and lookbehind
Programming
Software Development
10 Years Ago
by trishtren
Hello, im currently working on a program to split a string based on symbols only, i need to seperate the string around the symbols whilst keeping the symbols as well eg. test_String_123_^; would result in an array containing : [test] [_] [String] [_] [123] [_] [^] However although i have achieved it with this code : exampelstring.split(&…
Re: Shorten a regex lookahead and lookbehind
Programming
Software Development
10 Years Ago
by masijade
How about not using split, and, instead, using pattern and matcher with `(([^_^]+)?([_^])?)` i.e. package bogustest; import java.util.regex.Matcher; import java.util.regex.Pattern; public class BogusTest { public static void main(String[] args) { String test = "test_String_123_^"; Pattern…
Re: Shorten a regex lookahead and lookbehind
Programming
Software Development
10 Years Ago
by masijade
As a note though, '^' is a special character ONLY when used as the first character within square brackets, and an '_' is NOT a special character, at all, so there was no reason for the \\\\ occurances in your initial regex.
Re: Shorten a regex lookahead and lookbehind
Programming
Software Development
10 Years Ago
by sepp2k
> '^' is a special character ONLY when used as the first character within square brackets `^` means "beginning of the line" outside of square brackets, so it does need to be escaped. You're right about `_` though.
Re: Shorten a regex lookahead and lookbehind
Programming
Software Development
10 Years Ago
by masijade
Ach, yeah, idiot. Inside square brackets it does NOT need to be escaped, however (unless it is to be the only character in the brackets, otherwise, simply do not make it the FIRST character within those brackets).
Re: Matching "pi" but not "pie"
Programming
Software Development
17 Years Ago
by MattEvans
…(?![\w\d]))|3.14|g [/inlinecode] It has a negative
lookbehind
(?<![\w\d]) and lookahead (?![\w\d]) for characters preceeding…
Re: Need some help composing objects at runtime
Programming
Software Development
15 Years Ago
by vidaj
… like a charm :D Changed the regex to use negative
lookbehind
and lookahead to match the +, and a new regex to…
Re: Regular expression
Programming
Software Development
14 Years Ago
by marcinkuptel
Thanks Gribouillis! Your solution works very well. I found something even simpler though. It's called the 'negative
lookbehind
assertion'. [code=python] print re.split(r"(?<!\\)\^", 'Autocolli\^sion:No^Pack\^age:10DB15')[/code] The above line produces: ['Autocolli\\^sion:No', 'Pack\\^age:10DB15']
Re: Help me regarding preg_replace
Programming
Web Development
13 Years Ago
by pritaeas
… would be the best method for this, possibly a negative
lookbehind
. You can read about it here: [url]http://www.regular…
Re: find and replace
Programming
Web Development
13 Years Ago
by hielo
… tutorial, read about Positive and Negative Lookahead Positive and Negative
Lookbehind
but for what you are trying to do, you need…
Re: Matching 01010 with regex /010/?
Programming
Software Development
12 Years Ago
by d5e5
… use strict; use warnings; my $str = '01010'; #When 10 found, '
lookbehind
' to see if 0 precedes it. #If 0 precedes the…
Re: Java Split Text by Spaces and Punctuation
Programming
Software Development
12 Years Ago
by ~s.o.s~
It's possible to include exceptions by using [negative
lookbehind
assertion feature of regular expressions.](http://www.regular-expressions.info/…
Re: Why there is no spell check for posts and comments ?
Community Center
Meta DaniWeb
11 Years Ago
by deceptikon
… good parser, but there are quirks that make lookahead and
lookbehind
tricky. I may not need to do anything clever to…
Re: Program - To find the longest word from a sentences
Programming
Software Development
10 Years Ago
by deceptikon
… punctuation. To properly do it would require some lookahead and
lookbehind
, and even then poorly formatted sentences could cause an issue…
Re: Give a visual interface (GUI) to a console exe file
Programming
Software Development
9 Years Ago
by Garidius
Hello Suzie, Many thanks for your suggestion. I think C and C++ for what I investigated, don't handle
lookbehind
, lookahead or PCRE compatible regex. I'll check about C# since you mention that is very very easy to create a GUI :). Regards
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Forums
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC