I have a statement like Data lva_var type Integer value 20
. I need to find out the token after type
.
My latest try was [type](?:\s\S+)
, but the match was e integer
.
Code snippets would be helpful.
I have a statement like Data lva_var type Integer value 20
. I need to find out the token after type
.
My latest try was [type](?:\s\S+)
, but the match was e integer
.
Code snippets would be helpful.
Share Improve this question edited Sep 20, 2016 at 16:18 Alan Moore 75.2k13 gold badges107 silver badges160 bronze badges asked Sep 9, 2016 at 13:24 AKHIL RAJAKHIL RAJ 781 gold badge2 silver badges4 bronze badges 3- 1 You've tagged this with three different languages/environments - where do you need the Regex? – vwegert Commented Sep 9, 2016 at 13:55
- I need a general regular expression – AKHIL RAJ Commented Sep 9, 2016 at 14:04
- You misunderstand the question - which language will you be using this regular expression in? They vary, and you've marked it in two specific / different languages. Which is it? – random_user_name Commented Sep 9, 2016 at 15:20
3 Answers
Reset to default 7Just try this, type\s(\w+)
Here the first group contains the word next to "type"
Hope this code helps.
You can use lookbehind for this (?<=\btype\s)(\w+)
will do the trick for you. Take a look at this example.
JavaScript doesn't support lookbehinds, but since you tagged nsregularexpression
and that does support them, maybe try this: (?<=\btype\s+)\w+