regexp to match any initial substring of a string?
- From: Alexander Rast <alex.rast.technical@xxxxxxxxx>
- Date: Fri, 16 Sep 2011 10:00:25 -0700 (PDT)
This is either going to be easy, or impossible; I can't determine
which.
I want to search for words that form any legitimate leading substring
of a long potential string.
So let's say I had the string supercalifragilisticexpialidocious as a
match target, I want to match any word in the set {s su sup supe ...
supercalifragilisticexpialidociou supercalifragilisticexpialidocious}
occurring in the search string. (The search should use greedy matching
so as to suck up as much of the target as it can find)
It doesn't take much thought to realise how tedious this could become
using regexp if you have to define a separate branch for each
possibility. The problem is especially onerous if (such as I have) you
have several such long strings each of which should be tested
against.
Is there a regexp for this?
.
- Follow-Ups:
- Re: regexp to match any initial substring of a string?
- From: Alexandre Ferrieux
- Re: regexp to match any initial substring of a string?
- From: Aric Bills
- Re: regexp to match any initial substring of a string?
- From: Glenn Jackman
- Re: regexp to match any initial substring of a string?
- From: Alexandre Ferrieux
- Re: regexp to match any initial substring of a string?
- Prev by Date: Help please !! kbskit8.6 Mac OSX WITH XFT !
- Next by Date: Re: Morse code tcl script
- Previous by thread: Help please !! kbskit8.6 Mac OSX WITH XFT !
- Next by thread: Re: regexp to match any initial substring of a string?
- Index(es):
Relevant Pages
|