I have a simple problem I can’t seem to find an answer to. I need a regular expression that searches for all occurrences of a particular string. for example, if I were searching for any number pf occurrences of the string “hi”, then I would get matches on strings like:
hihi
12hi11h
hi34hi
but not on:
hh1ii
iiihh1h
The regex to match a string is the string itself.
Remember to escape any special characters, though.
For an example, the string that matches any number of occurrences of “hi” is:
hiNOTE: in
egrep, you need to put your regex in single quotes:egrep '(hi){2,}' file.txt