blackberryfan234
blackberryfan234

Reputation: 35

Regular Expression For Quoted String

If I have the following data:

"test1"."test2" AND "test1"."test2"

What regex can I use to match "test1"."test2"?

I tried the following but it did not work.

\b"test1"."test2"(\s+|$)

In the given example I'd like to match "test1"."test2", and, "test1"."test2"

Upvotes: 0

Views: 343

Answers (2)

Tim Pietzcker
Tim Pietzcker

Reputation: 336478

\b matches at a word boundary, i. e. just before or after an alphanumeric character. Since " is not alphanumeric (and assuming that there is no word character right before it), the assertion fails - and therefore the entire regex.

Drop the \b, escape the dot, and you're set.

Upvotes: 1

Gopi
Gopi

Reputation: 10293

This should work

"test1"\."test2"

Upvotes: 0

Related Questions