Weird in a regular expression

I tried the following regular expression:

Pattern: ((.[^[0-9])+)(([0-9]{1,3}([.][0-9]{3})+)|([0-9]+))

My goal is to match any string (excluding digit number) followed by a specified number, e.g. MG2999, dasdassa33232

I used the above regular expression.

It's weird as follows:

V375 (not matched)

Vv375 (matched)

Vvv375 (not matched, but first character is not matched)

Vvvv375 (matched)

...

I don't understand why the first character is never matched. May I need your help?

For your quick test, please try: http://regex101.com/

Thanks in advance!

-- Vu

Answers


(.[^[0-9])+) matches any character (.), followed by any character except digits and [, repeatedly.

You probably want [^0-9]+ here – or, simpler, \D+.

The rest of there regular expression has similar problems but since I don’t know the number format you want to match I cannot correct that.


Need Your Help

How do you get the value of the JFrame title?

java swing title getvalue

I want to be able to get the string from the JFrame. This is because the title of the JFrame is not constant and is dependent on variables.

ie8 not rendering @font-face fonts on first page load or refresh

html css internet-explorer-8

Here is the website in question: https://www.cocokeyorlando.com