Is there a way to recognize a string in up to certain characters, not including the characters themselves?

For example, my regex /.*index[.]php[?]?/g

on the following lines:

 http://localhost/esculape/www/index.php?a=10 http://localhost/esculape/www/index.php 

finds:

 http://localhost/esculape/www/index.php? http://localhost/esculape/www/index.php 

And I need the whole line, but before index.php?a=10 , the result should be

 http://localhost/esculape/www/ 

Link to my example

    1 answer 1

    You can use the advance test if it is supported by your regular expression dialect

     /.*(?=index[.]php[?]?)/g