Jump to content

Recommended Posts

I'm trying to write a regex for a url that starts out with the same subdomain.domain and so and then deviates with the arguments that are sent to it.

 

What I originally thought was working:

%http://appraisalzone.lendervend.com/AssignOrder.aspx.[a-zA-Z0-9/?=&-]{1,}/.$%

 

I'm parsing this out of an email and it turns out that email has the link somewhat different than it appears in a client.  It looks like the link is partially in hex?

 

anyway the print_r of the email from stdin() gives this link:

<a =

href=3D"http://appraisalzone.lendervend.com/AssignOrder.aspx?orderid=3D35=

7262&userid=3D116315&customerorderid=3DEFC33B67-A60D-434B-99E1-7D=

4FA5C9DA1C

 

There are also either newline or carriage returns in there that I'm not sure how to allow for in the regex.

 

Link to comment
https://forums.phpfreaks.com/topic/240095-why-isnt-this-working/
Share on other sites

The email's in HTML entities. Just run it through html_entity_decode first. As for matching new-lines, you can add the 's' modifier after the last percent:

 

[...] {1,}/.$%s

 

Edit: Actually if the email string is split over multiple lines, you might want to first remove line-breaks, using similar to:

 

$string = str_replace(array("\n", "\r"), '', $string);

 

.. As the 's' modifier will allow only the dot character to match over multiple-lines.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.