Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the regex for a URL like this?

Tags:

regex

I don't really know regex, but would like a quick solution to search and replace links. I want to use the search regex wordpress plugin to remove links in my post. How do I format the regex to a link like this:

http://website.com/index.php?id=934&title=item name

edit: the numbers in the id and the item name varies

Thank you in advance!

like image 788
user1122581 Avatar asked Nov 14 '22 12:11

user1122581


1 Answers

Try this one out: http://regexr.com?2vjq6

Depending on whether or not you need whitespace in your "title" parameter, the regex I provided may need to be altered. Best practice would be to not have whitespace in your URLs (use URL encoding instead, where a space = %20).

http://website.com/index.php\?id=[0-9]*&title=[a-zA-Z0-9\-]*
like image 119
Tim M. Avatar answered Dec 23 '22 11:12

Tim M.