My CSV file contains lines like these..
"A","234234","7UM*","2345","00070","12343","120 DEL J.NORRIS"
"B","23423","8UM*","2345","00070","12343","120 DEL J.IMTIH"
"V","1234","6UM*","2345","00070","12343","ABCDEFG"
"V","1234","6UM*","2345","00070","12343",""
I want to find rows where last column (eg. "120 DEL J.NORRIS") contains any numeric values i.e. 1st and 2nd row but not 3rd and 4th row
Is this possible via RegEx?
Thank you very much
Help with RegEx and csv file
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
[0-9][^"]*"$ matches
The $ anchors the match to the end of the line. So the regex matches if a line contains a digit and ends with a " , and there is no intervening " between that digit and that final ". The regex matches everything from the digit to the end of the line (but not the newline itself).
^.*[0-9][^"]*"$ matches
So this regex matches any whole line containing what the first regex matches.
Code: Select all
1. [0-9] any digit
2. [^"]* a string not containing double quotes, that is:
2.1 [^"] any character except double quote
2.2 * repeated any number (possibly zero) of times
3. " a double quote
4. $ the end of a line
^.*[0-9][^"]*"$ matches
Code: Select all
1. ^ the beginning of a line
2 .* any string within a line, that is:
2.1 . any character except newline
2.2 * repeated any number (possibly zero) of times
3. [0-9][^"]*"$ as above