I have a long string that contains information like this:
|infoId-*-info||infoId-*-info||infoId-*-info| ...
I use the '-*-' character as seperator and I want to make searching just on right side of '-*-' character but it should return whole part of infoId-*-info if it match any info , is there anyway to do that?
Thanks in advance
Example:
This is my String :
|8d9f9a0g9r8ad8f-*-sedat||0sdf7a89s9d0wg-*-derya||9g7a6w6e7d89awwe-*-caner|
for this string if my search value is "edat" how can I return whole 8d9f9a0g9r8ad8f-*-sedat string, and if my search value is "s" it shouldnt return also 0sdf7a89s9d0wg-*-derya because of left side of "-*-" contains "s" character.
If u can give me jsfiddle link that supports this example it will be very wellcomed thanks so much for spending time.
Sounds like you need something along the lines of
(we don’t know how your
infoIdandinfoare structured).EDIT following the example added by OP
You can use (for
edat):I don’t know which language you are using but you can use the “global” flag to get all matches in the string at once. If it’s JS, it will be
/\|([^-]+-\*-[^|]*edat[^|]*\|/g.