0

I've got a string i need to match:

/sw/unicad/C32_SC_12_CLKPBP10_LR/2.0/CADENCE/LEF/C32_SC_12_CLKPBP10_LR_soc.lef

I've come up with

static const boost::regex lefFilePath("/?(([[:word:]]*)/)*([[:word:]]*)\.lef");  

Yet it doesn't match. Can I get a hand please?

2 Answers 2

1

The problem is that the dot in 2.0 isn't matched by the [:word:] shorthand, so you need to include it in the character class.

You probably also should escape the backslash.

Try this:

static const boost::regex lefFilePath("/?(([[:word:].]*)/)*([[:word:].]*)\\.lef");
Sign up to request clarification or add additional context in comments.

Comments

1

You have a 2.0 in your string, the . is not in the [[:word:]] character class.

The square brackets are defining character classes and you can add the characters you want to be included in that class. So please try

[[:word:].]

The . is treated literally inside a character class, so you don't need to escape it there.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.