I'm trying to create a regex query to extract everything between the characters
^1234:
and
, ^5678:
I tried the following and it doesn't work. Am i on the right track?
^(\^1234),(\^5678)$
Example text:
54:16812344266, ^1234:iwantthistext, ^5678:idontwantthis, ^0000: idontwantthiseither
If you're using
sed, you can do something like this:You want to use the
()to capture the match in between the strings. Then replace the full value with the capture text.The first
.*will match everything before^1234and the second.*will match everything after^5678. The^needs escaping with a backslash soseddoesn't use it for interpolation.