Professional Documents
Culture Documents
Oraclesqlnote
Oraclesqlnote
Oraclesqlnote
Why?
The character class [A-z] matches some non-alphabetical characters like [, ] among
others.
[a-z]{2}[0-9]{3}
If you want to match a string if it has 2 letters followed by 3 digits and nothing
else use both start anchor ^ and end anchor $ as
^[a-z]{2}[0-9]{3}$
codaddict
295k56399466
Hi, It was a string of exactly two a-z followed by three 0-9. Cheers. � Scott Brown
Dec 2 '10 at 11:45
The character class I'm using the the ' Find any character from uppercase A to
lowercase z' as found on w3schools.com/jsref/jsref_obj_regexp.asp. Is this not
recommended? � Scott Brown Dec 2 '10 at 12:03
@Scott: It is not recommended. Please see my updated answer. � codaddict Dec 2 '10
at 12:14
Ok, thanks for the update and explanation. � Scott Brown Dec 2 '10 at 12:22
add a comment
up vote
1
down vote
Alternatively you can use:
/\b([A-z]{2}[0-9]{3})\b/g
if your string contains multiple words and you are trying to match one word.