I want to extract a substring from a string.
I have strings like this:
English !'O!Kung Proper noun # A northern variety of the [[!Kung]] [[dialect]] [[continuum]], now principally found in northern Namibia.
or:
English & Conjunction # {{abbreviation of|and}}
These are only two examples.
What I want is to get the word and its part of speech.
E.g.:
- !’O!Kung – Proper noun
- & – Conjunction
I came up with this regex: /English (.*) (Proper noun|Conjunction)+/i
However it doesn’t seem to work. Any idea? 🙂
UPDATE:
I figured out that this one works: /English\s+(.*)\s+(Proper noun|Conjunction)+/i
I figured out that this one works well in PHP:
/English\s+(.*)\s+(Proper noun|Conjunction)+/i