I have a regular expression to find functions in files.
See how expression perfectly works in PHP
If I try to run same regex with grep from console, I get an error:
grep -rP "(_t\s*\(\s*([\'\"])(\d+)\2\s*,\s*([\'\"])(.*?)(?<!\\)\4\s*(?(?=,)[^\)]*\s*\)|\)))" application scripts library public data | sort -n | uniq
grep: unrecognized character after (?<
Looks like grep
can't handle this part of regex (?<!\\)
, which is important for me.
Can anyone advise how to modify regex to make grep
work with it?
EDIT:
String: _t('123', 'pcs.', '', $userLang) . $data['ticker'] . ' (' . $data['security_name'] . ')
Need to find:
index in function ('123')
text in function ('pcs.')
function itself
> _t('123', 'pcs.', '', $userLang)