Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6219123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:43:32+00:00 2026-05-24T07:43:32+00:00

I need help with a REGEX that will find a link that comes in

  • 0

I need help with a REGEX that will find a link that comes in different formats based on how it got inserted to the HTML page.

I am capable of reading the pages into PHP. Just not able to the right REGEX that will find URL and insulate them.

I have a few examples on how they are getting inserted. Where sometimes they are plain text links, some of wrapped around them. There is even the odd occasion where text that is not part of the link gets inserted without spacing.

Both Article ID and Article Key are never the same. Article Key however always ends with a numeric. If this is possible I sure could use the help. Thanks

Here are a few examples.
http://www.example.com/ArticleDetails.aspx?ArticleID=3D10045411&AidKey=3D-2086622941

http://example.com/ArticleDetails.aspx?ArticleID=10919199&AidKey=1956996566    

<a href="http://www.example.com/ArticleDetails.aspx?ArticleID=10773616&amp;AidKey=1998267392">http://www.example.com/ArticleDetails.aspx?ArticleID=10773616&amp;AidKey=1998267392</a>

<a href="http://www.example.com/ArticleDetails.aspx?ArticleID=10773616&amp;AidKey=1998267392">This is a link description</a>

http://example.com/ArticleDetails.aspx?ArticleID=10975137&AidKey=701321736this is not part of the url.

In the end I am just looking for the URL.

http://example.com/ArticleDetails.aspx?ArticleID=10975137&AidKey=701321736
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:43:33+00:00Added an answer on May 24, 2026 at 7:43 am

    This regex work for me:

    /http:\/\/(www\.)?example\.com\/ArticleDetails.aspx\?ArticleID=(.*?)(\&|\&amp;)AidKey=([\d\w-]*)/g
    

    UPDATE:
    I added a \d at the end of the regex.

    /http:\/\/(www\.)?example\.com\/ArticleDetails.aspx\?ArticleID=(.*?)(\&|\&amp;)AidKey=([\d\w-]*)\d/g
    

    To use it in PHP you need /.../msi

    PHP Example in action: http://ideone.com/N0TKM

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help with a regular expression that will find matches in the strings
I have a regex call that I need help with. I haven't posted my
I need help writing a regex for a phone number pattern that allows the
I need some Regex help. I need to find beacon_ followed by an alphanumeric
I need a quick REGEX to use with preg_replace() in PHP that will remove
I really need help with interfaces in general... Any resources that you guys would
so I'm wanting to do something like this: I've got a variable that will
I am hoping that someone maybe able to help me. I need to create
I am trying to load a html page through UIWebview.I need to disable all
need some help from a regex jedi master: If I have a string of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.