On my debian machine, I’m playing around with some code and regex. So anyway, I’m looking to find the following pattern in some code files:
function(some text $tring||$_string)
Currently I’m using the following command
find . -type f | xargs grep "function"
I tried using
find . -type f | xargs grep "function(*$string||$_tring*)"
but it did not work.
Essentially it needs to search all patterns that match the following rules
- includes function()
- inside function, match the either of the following strings
- $string or
- $_tring
How do I do this?
To be able to handle filenames containing spaces, and also if there are a lot of files.
man 3 regexif you want to read more about the regex syntax: