finding <
Moderator: General Moderators
- prometheuzz
- Forum Regular
- Posts: 779
- Joined: Fri Apr 04, 2008 5:51 am
Re: finding <
The regex for that is:michelvh wrote:I have to find "five < six"
in the next line:
five < six<Tr>
Can someone give a regexp for this?
Can't find the solution.
Michel
Code: Select all
'/five < six/'Good luck.
Re: finding <
That's not what I am looking for, "five < six"
is just an example.
What I have to find is
from the beginning of the string all
characters until a < is followed by a T. (not a space)
Michel
is just an example.
What I have to find is
from the beginning of the string all
characters until a < is followed by a T. (not a space)
Michel
- andyhoneycutt
- Forum Contributor
- Posts: 468
- Joined: Wed Aug 27, 2008 10:02 am
- Location: Idaho Falls
Re: finding <
Code: Select all
'/(.+)<T/'- prometheuzz
- Forum Regular
- Posts: 779
- Joined: Fri Apr 04, 2008 5:51 am
Re: finding <
Yes, I figured that much. My point was that you gave a very unclear explanation of your problem with just a single example and without a proper explanation of your requirement. Wouldn't you agree?michelvh wrote:That's not what I am looking for, "five < six"
is just an example.
...
- prometheuzz
- Forum Regular
- Posts: 779
- Joined: Fri Apr 04, 2008 5:51 am
Re: finding <
That won't work for:andyhoneycutt wrote:-AndyCode: Select all
'/(.+)<T/'
Code: Select all
five < six<Tr seven > six <Tr>Code: Select all
five < six \n seven > six <Tr- andyhoneycutt
- Forum Contributor
- Posts: 468
- Joined: Wed Aug 27, 2008 10:02 am
- Location: Idaho Falls
Re: finding <
True, it won't work for the above examples. It almost matches for the criteria specified, with the exception that I didn't match for white space. This may be a more precise pattern:This matches:
-Andy
Code: Select all
'/([\w\s]+<[\w\s]+)+<T/'Code: Select all
'a < b <T'
"a \n<b <\n c...<T"
'a < b < c ... <T'Re: finding <
What I have to find is
from the beginning of the string all
characters until a < is followed by a T. (not a space)
Code: Select all
^.*?(?=<T)