View Full Version : A question regarding RegExp

Mr J
04-17-2005, 08:39 PM
Is it possible using regExp to check that the numbers in string1 exist in string2 and are in the same order irrespective of the fact that there might be other non-numerical characters mixed in with them

04-17-2005, 08:52 PM
yes you can.

feel like providing an example to work from?

Mr J
04-17-2005, 09:37 PM
As you can see the numbers in string 1 are in the same order as in string 2 even though there are other characters present in both strings.

str1 = "6/3 9-38-4 2/0"

str2 = "6-3/93-as84/2-0"

so I am looking to see if 63938420 exists in both strings and in that order

The numbers themselves may change in value but should be the same in both strings and in the same order

str1="8-/3 - 6/-2 sd 7bg4"

str2="8at/3-6 2// 7-4"

836274 should exist in both string in the same order

Thank you

Harry Armadillo
04-17-2005, 10:14 PM
//numerals match!!

Mr J
04-19-2005, 02:47 PM
Thank you it worked a treat :thumbsup: