Solved

Pattern Matching %20 in url

Posted on 2014-01-31
5
649 Views
Last Modified: 2014-01-31
I have several urls that have %20''s in the actual url.  I want a regex that will point it to the correct page.  I can get it to work with the first 3 letters but don't know how to add in the %20.  I have tried \W and \s but to no avail.

If it is working correctly then a url with function.php shouldn't be matched.

This is an example url in question.
funct%20in%20/var/www/html/modules/cdseolinks/function.pa%20in%20/var/www/html/modules/cdseolinks/function.parse-url

Here is what I have.

RedirectMatch 301 ^/fun\s(.+?)$ /help.php

By the way, the ideal thing I know already but I don't have any support on that program to know how to fix the problem.  So that is why I am resorting to a pattern match.  Rather than getting the program to quit putting the erroneous characters into the urls when it is spidered.

Thanks,
0
Comment
Question by:sharingsunshine
  • 3
  • 2
5 Comments
 
LVL 11

Accepted Solution

by:
Angelp1ay earned 500 total points
ID: 39824603
I can't see how the help.php in your regex is related to your example URL.

Not really sure what you're asking for. I assumed you wanted things starting fun and ending with /help.php which might have the grouping %20 in them.

This should match %20 without matching %something_else...
fun((%20)|[\s\w\/\.\-])*\/help.php

Open in new window

0
 

Author Comment

by:sharingsunshine
ID: 39824782
that matches the %20 perfectly and /or a space.  So that is great.
0
 

Author Closing Comment

by:sharingsunshine
ID: 39824784
I appreciate your help.
0
 
LVL 11

Expert Comment

by:Angelp1ay
ID: 39824958
No problem :) Have a lovely weekend!
0
 

Author Comment

by:sharingsunshine
ID: 39824995
You too!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
Fine Tune your automatic Updates for Ubuntu / Debian
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now