Matt H.
Matt H.

Reputation: 10776

RegEx Help.. something wrong in my pattern

I'm looking to match this pattern:

 ((##.##.##))

Any series of Numbers/Decimals, surrounded by "((" and "))", and preceded by one whitespace

There can't be any characters in the middle except digits and periods.

Right now I have

"\s(\(){2}[\d\.]+(\)){2}"

but i'm not getting any matches...

Upvotes: 1

Views: 75

Answers (2)

Mike
Mike

Reputation: 674

You don't have to escape the period inside [] braces. Try this:

\s\(\([.\d]+\)\)

Upvotes: 0

AaronJ
AaronJ

Reputation: 1170

\s\(\([[.]|\d]+\)\)

seems to work. As a Java String that looks like this.

\\s\\(\\([[.]|\\d]+\\)\\)

You can test regular expressions online at various sites like http://www.regexplanet.com/simple/index.html.

Maybe it will work in VB too.. good luck.

Upvotes: 1

Related Questions