Displaying page
of
pages;
Items to
| Title |
Test
Details
Parse Comma Delimited Strings
|
| Expression |
^(?<field1>[^,]+),(?<field2>[^,]+),(?<field3>[^,]+)$ |
| Description |
Example of a regular expression that can be used to parse a comma delimited string into constituent, named sub-strings. Add or remove regex subfield definitions (?<field1>[^,]+) and corresponding delimiting characters in the regular expression as necessary to accommodate the string and subfields you intend to parse. Optionally, rename the subfield names in the regular expression to more meaningful names if you are using the parsed sub-strings in a program. Replace all occurrences of the comma in the regular expression with any required alternative delimiting character. As long as the delimiting character used does not occur naturally in any of the sub-strings, you should be good-to-go. NOTE: To change the delimiter character you must replace all occurrences of the comma in the current regex (of which there are 5) with the new delimiter character. e.g. (?<field1>[^;]+); changes the delimiter character to a semi-colon for the first field. |
| Matches |
Fred,Barnie,Wilma | Bob,1/1/2003,222-3333 | 100,200,300 |
| Non-Matches |
Fred,Barnie,Wilma,Betty | Bob;1/1/2003;222-3333 | Tom Dick Harry |
| Author |
Rating:
Not yet rated.
Jerry Schmersahl
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([1-9]{1}[0-9]{0,7})+((,[1-9]{1}[0-9]{0,7}){0,1})+$ |
| Description |
Validate a comma delimited string of integer between 1 and 99999999 (change {0,7} to whatever you need). No zero leading. |
| Matches |
1,2,3455,12345678 | 23045,34678,2892 | 1,2,99999999 |
| Non-Matches |
01,234,567 | 123,0445,3434, | 121,,1212,,12, |
| Author |
Rating:
Ivan Rodriguez
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([A-Za-z0-9]\s?)+([,]\s?([A-Za-z0-9]\s?)+)*$ |
| Description |
This regular expression can be used to parse a comma delimited string. Leading whitespaces (at the beginning of the entire string) and ending commas are not acceptable. Any combination of letters and numbers with zero or one white space between them are acceptable. Note: To change the delimiter, simply replace the comma in the square brackets to the delimiter of choice. |
| Matches |
123, 4567, 8901 | abc, defghi, jklmn | abc123 |
| Non-Matches |
abc123 | abc123, | ,abc123 |
| Author |
Rating:
Rehan Azam
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(?n:(?!-[\d\,]*K) (?!-((\d{1,3},)*((([3-9]\d\d|2[89]\d|27[4-9])\xB0C)|(((4[6-9]|[5-9]\d)\d)\xB0F)))) -?\d{1,3}(,\d{3})*(\xB0[CF]|K)
)$ |
| Description |
Temperature scale. From ABSOLUTE ZERO up. Can use the Fahrenheit, Celsius or Kelvin Scale. The Degree symbol is required for Fahrenheit and Celsius. Numbers over 1,000 must be comma delimited. |
| Matches |
32°F | -10°C | 4,000K |
| Non-Matches |
-460°F | 1000°C | -1°K |
| Author |
Rating:
Not yet rated.
Michael Ash
|
| Title |
Test
Details
Pattern Title
|
| Expression |
((\s*([^,{]+)\s*,?\s*)*?){((\s*([^:]+)\s*:\s*([^;]+?)\s*;\s*)*?)} |
| Description |
will break out a valid CSS stylesheet into it's components. Groups on each style, all selectors, each selector within a comma delimited list of selectors, all properties, each property set, each property and each value. In other words, it breaks it all down for you :)
The only two problems I'm having with it:
A) it is ignorant of comment blocks. so if you have styles within a /* */ block, it'll pick those up.
B) the first style following a comment block is not parsed correctly (it incorrectly includes the comment as a selector
best thing to do would be to use another regexp to remove all comments before processing with this one |
| Matches |
div#main { position:relative; width:809px; margin-left:auto; margin-right:auto; padding:0; } |
| Non-Matches |
----- |
| Author |
Rating:
Nick Franceschina
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([1-9]{1}(([0-9])?){2})+(,[0-9]{1}[0-9]{2})*$ |
| Description |
Matchs comma delimited numbers. Easily changed to allow for other delimiters. (Edit ",")
Does not allow a leading 0
Does not allow groups of numbers with less than 3 numbers, exculding the first group. |
| Matches |
123,123,123,123 | 100,120,000,010,011 | 1,123,123,123 |
| Non-Matches |
012,123,123,123 | 12343,1244,4,12 | ,123,123,123 |
| Author |
Rating:
Gregory Lyons
|
| Title |
Test
Details
Validate Multiple Email Addresses
|
| Expression |
^((\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)\s*[,]{0,1}\s*)+$ |
| Description |
This will validate multiple email addresses that are comma delimited. You can change it to use commas or semilcolons. If you have to worry about a lot of special characters, you may have to edit it a little bit. It allows white space before and after the comma. |
| Matches |
|
| Non-Matches |
|
| Author |
Rating:
Dan Lorenz
|
| Title |
Test
Details
SKK-STRING-Parse Comma Delimited Strings
|
| Expression |
^(?<field1>[^,]+),(?<field2>[^,]+),(?<field3>[^,]+)$ |
| Description |
Parse Comma Delimited Strings
----------------------
http://regexlib.com/REDetails.aspx?regexp_id=538 |
| Matches |
A,B,C |
| Non-Matches |
??? |
| Author |
Rating:
Not yet rated.
skk
|
| Title |
Test
Details
validation of comma delimited ICD9 codes
|
| Expression |
^([EV])?\d{3,3}(\.\d{1,2})?(, *([EV])?\d{3,3}(\.\d{1,2})?)*$ |
| Description |
See my sigle ICD9 validator for ICD9 rules. This does the same, and validates for comma delitter (with optiona space after comma) |
| Matches |
E123 | E123.45, V456.6 | V456,E987.2, 123.45 |
| Non-Matches |
E123V456 | E123, x | 12;467.789 |
| Author |
Rating:
Not yet rated.
Ken Forslund
|
| Title |
Test
Details
comma delimited CPT code
|
| Expression |
^\d{4,4}[A-Z0-9](, *\d{4,4})[A-Z0-9]*$ |
| Description |
see my regex for explaining basic CPT. This validates a comma delimited (with possible spaces after comma) string of CPT codes |
| Matches |
99396, 1234T | 12345 | 12345,98765, 99396 |
| Non-Matches |
1234T, x | 99396, 1234t |
| Author |
Rating:
Not yet rated.
Ken Forslund
|
| Title |
Test
Details
match value in comma delim string
|
| Expression |
(\A|(.*,))VALUE(\z|([,]?.)) |
| Description |
use this to see if your VALUE is in a given string that is comma delimited. Replace VALUE with your own |
| Matches |
VALUE,1 1,VALUE,2 VALUE VALUE,1 |
| Non-Matches |
1 1,2 |
| Author |
Rating:
Not yet rated.
Ken Forslund
|
Displaying page
of
pages;
Items to