R. Rahul
R. Rahul

Reputation: 1186

retrieve quoted string using expression language

How to retrieve the quoted value of a property.

suppose you have some expression like:

[html:text property="pqrs" styleClass="text" style="width:200px"].

And now i want to retrieve the value of property, styleclass and style ie "pqrs", "text" and "width:200px" respectively.

Can you guys please help me in this.

thanks a lot.

Upvotes: 1

Views: 215

Answers (2)

Stephen Chung
Stephen Chung

Reputation: 14605

(\w+)\=\"(.*?)\"

The first capture group (\w+) gives you the attribute name, and the second capture group uses a non-aggressive operator to match things inside quotes.

Upvotes: 1

Carl Norum
Carl Norum

Reputation: 224864

If you just want the text in quotes, a non-greedy match should work:

".*?"

Upvotes: 2

Related Questions