Gilles wrote:
Hi,

I try do to a < simple > thing :

Knowing If a string like "13" exist in a string like "123"

Or if "37" exist in "12356789"

I tried many solutions, but never found one good so I try to do it with
loops which more difficult but not impossible

I'd like to know if with RegExp  it's more simply

No, it's not possible with RegExp. What you want is called the Longest Common Subsequence. See http://www.ics.uci.edu/~eppstein/161/960229.html for a description of the algorithm. There are a number of modules in CPAN http://search.cpan.org/ under "LCS" http://search.cpan.org/search?query=lcs&mode=module but since I don't use any, I won't recommend any.


--

Just my 0.00000002 million dollars worth,
   --- Shawn

"Probability is now one. Any problems that are left are your own."
   SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to