Christian
Christian

Reputation: 242

How can i match this with ruby regex {{article | image}}

It also needs to work for {{ article |image}} or any other withespace combination inside the double braces.

Upvotes: 0

Views: 143

Answers (2)

Paul Creasey
Paul Creasey

Reputation: 28894

Need a lot more information about exactly what you need and the type of data you are searching.

{{.*}}

This will work for both examples.

{{\s*\w+\s*\|\s*\w+\s*}}

Is much more specific.

Upvotes: 1

Rubens Farias
Rubens Farias

Reputation: 57996

This will match all your {{ }} content:

{{([^}]*)}}

Upvotes: 1

Related Questions