I wanted to use regex to match and replace anything between my file name and closing parentheses.
I wrote a regex:
/(?<=imagecheck.php)[^)]*/
That works in php, but not in Javascript.
…How would I do in JS?
example:
input string example 1: url(127.0.0.1/imagecheck.php)
input string example 2: url(127.0.0.1/imagecheck.php?boost=9881732213826123918238)
outcome string example: url(127.0.0.1/imagecheck.php?reload=oh_yes_plx&boost=123810982346023984723948723023423)
Look-behind is not supported in Javascript. You can use capturing group to capture the text after
"imagecheck.php"instead:The result will be in index 1 of the returned array (if there is a match).
This is an example of removing whatever after
"imagecheck.php"