yep, converted to php, 1 line of code with
preg_match($pattern, $line, $match_array)
(a few more lines with the loop around it and the other pattern matches)
my favorite bit, the echo at the end of the function that returns:
.... cleaning .... 24396 records processed .... 1.1162s
thx again...
thanks vbkris, with your help i worked it out.
solution
<script>
//orginal string
str1="5..... LASTNAME LASTNAME, FIRSTNAME MIDDLENAME NAME2 DR. 32 R"
//remove excess whitespace
str=str1.replace(/\s+/," ")
TheNumber=str.replace(/^(\d+).*/,"$1")...
this is great ... almost! works for about 80%.
the problem is the the name middle name and title pattern.
- there can actually be 1,2 or even 3 names
- the whitespace between the last of the names and the title varies (not always 10)
i'm now removing all the excess whitespace, so the string...
having trouble with a regular expression. i have an ugly text file to parse that includes the following line
5..... LASTNAME LASTNAME, FIRSTNAME MIDDLENAME TITLE 32 R
the 5..... the 1st character is always a 1 digit number, followed by 1 to 9 '.'
the 32 is age,
the R is a 1...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.