Examples for Regular Expressions #532
Replies: 5 comments
-
|
Hi, Please find below another regular expression that might come in handy :
Thanks, Oriel Belzer Oriel Belzer (Oriel.B) - 10/21/2012 02:14 AM
|
Beta Was this translation helpful? Give feedback.
-
|
The problem with your IP address regex is that it will validate invalid IPs. I use the following for IP validation:
Breakdown:
This prevents fat fingering 10.10.40.120 into 10.10.401.20 and other mistakes like that. undefined (Quali) - 11/14/2012 12:25 PM
|
Beta Was this translation helpful? Give feedback.
-
|
Hello, Why Regular expression ^([0-9]{4})-([0-1][0-9])-([0-3][0-9])\s([0-1][0-9]|[2][0-3]):([0-5][0-9]):([0-5][0-9])$ forYYYY-MM-DD HH:MM:SS in Testshell 4.8 is not valid ? Thanks!
undefined (Quali) - 04/30/2013 05:54 AM
|
Beta Was this translation helpful? Give feedback.
-
|
Hi Xiao, With small modifications, I was able to extract date-time from any string using your Regex expression: In a transformation step, I used the following input in the Regular Expression field: {'([0-9]{4})-([0-1][0-9])-([0-3][0-9])\s([0-1][0-9]|[2][0-3]):([0-5][0-9]):([0-5][0-9])'}
Notice that the string is wrapped with {' and '} to indicate a sting input. I removed the ^ and the $ chars so I could match the date-time anywhere in the text:
Since you grouped the different elements of the date-time string, you can also extract this string to a date-time vector by clicking "Extract Groups": undefined (tal.a) - 04/30/2013 07:23 AM
|
Beta Was this translation helpful? Give feedback.
-
|
Hi Tal, Thanks! It's very useful! undefined (Quali) - 04/30/2013 09:53 AM
|
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Regular Expression
Pattern
\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
IP
(0[1-9]|[12][0-9]|3[01])[-/.](0[1-9]|1[012])[-/.](19|20)\d\d
Date indd-mm-yyyy format
[-+]?[0-9]*\.?[0-9]+
Floating point number
^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$
Email address
([A-Z,a-z,0-9]*\.[A-Z,a-z,0-9]*)
File Name (name.extension)
\d
Digit (numeric)
\w
Character (letter, digit, underscore)
\r\n
Linebreak
\s
Whitespace
A more detailed article with examples and common mistakes (and how to avoid them...) can be found here:
http://www.regular-expressions.info/examples.html">http://www.regular-expressions.info/examples.html
(Quali) - 09/02/2012 01:42 PM
· 2625 ·
Beta Was this translation helpful? Give feedback.
All reactions