i need to match a pattern using reMatchNoCase("(listid)","listid car van listid dog cat listid house hotel")> so listid is the pattern and match that and everything to the next pattern witch is listid again.
so if i dump the rematch ill get a structure each starting with listid and the content within
this is what it should look like
-
listid car van
-
listid dog cat
-
listid house hotel
etc….
when i use reMatchNoCase("(listid)","listid car van listid dog cat listid house hotel")> it will only create a structure with “listid” and nothing more like car van… what regex do i use after (listid) to get everything within?
thanks
You can use this regex
What this regex does is locate a ‘listid’ followed by any characters until next ‘listid’ or ‘end of line ($)’. The
?=is the positive lookahead to look for the next ‘listid’ but not make it part of the match. The?in.*?avoids greedy behavior of.*and matches immediate next lookahead string.