Is there a way to use regex locating the second input (after comma) inside a php function and and use replace to remove it?
I would like to use this in sublime text to remove an input field inside a function that is used across many pages.
I want this function:
LoggFor ($brukerid, $dato, $sysreg, $dat_1 = '', $dat_2 = '', $dat_3 = '', $dat_4 = '', $dat_5 = '', $dat_6 = '', $dat_7 = '')
To be replaced with:
LoggFor ($brukerid, $sysreg, $dat_1 = '', $dat_2 = '', $dat_3 = '', $dat_4 = '', $dat_5 = '', $dat_6 = '', $dat_7 = '')
The problem is that the input across many different pages is not as mentioned above. In other words, I want to remove 2nd input from all functions regardless of variable name.
Use
LoggFor\s*\([^),]*\K,\s*[^,)]*
Replace with an empty string.
Details
LoggFor
- a literal substring \\s*
- 0+ whitespaces \\(
- a (
[^),]*
- zero or more chars other than )
and ,
\\K
- match reset operator (all text matched up to this place is omitted from the match and thus, it will remain) ,
- a comma \\s*
- 0+ whitespaces [^,)]*
- zero or more chars other than )
and ,
See the screenshot with settings:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.