Dr.Kameleon
Dr.Kameleon

Reputation: 22820

Get parameters from wikipedia template

OK, so basically I'm trying to parse a rather simple Wikipedia template.

Let's say we have :

{{ unbulleted list | item 1 | item 2 | li_style=font-size:88%; }}

(hint: spacing can be quite flexible, e.g. unbulleted list|... is also possible)

So, you can see that after unbulleted list, we have several instances of | something.

What I want to match is all of those instance that do not contain =.

How can this be achieved?


This is my current regex (but it's not working...) : http://regexr.com?384sk

{{unbulleted list(.+?)?(\|[^=]+)+

UPDATE:

Well, I think I'm rather close to solving the... riddle...

\|([^=\|}\r]+)(?=[\|}])

http://regexr.com?384sq

Upvotes: 2

Views: 92

Answers (1)

Stephan
Stephan

Reputation: 43033

What about this regex ?

(?<=\|)\s*([^|={}]+)\s*(?=\||}})

Description

Regular expression visualization

Demo

http://regex101.com/r/mO0cG4

Upvotes: 2

Related Questions