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

  • Home
  • SEARCH
  • 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 4608228
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:48:54+00:00 2026-05-22T00:48:54+00:00

The strings looks like hyperlinks, such as http://somethings . This is what I need

  • 0

The strings looks like hyperlinks, such as http://somethings. This is what I need :

  1. I need to check them only if they doesnt start with the character "; I mean, only that characters : if before there aren’t characters it must check;
  2. That somethings string means that every kind of characters can be used (of course, is a link) except a whitespace (The end marker link); I know, it’s permitted by RFC, but is the only way I know to escape;
  3. these string are previously filtered by using htmlentities($str, ENT_QUOTES, "UTF-8"), that’s why every kind of characters can be used. Is it secure? Or I risk problems with xss or html broked?
  4. the occurences of this replacement can me multiple, not only 1, and must be case insenstive;

This is my actual regex :

preg_replace('#\b[^"](((http|https|ftp)://).+)#', '<a class="lforum" href="$1">$1</a>', $str);

But it check only those string that START with “, and I want the opposite. Any helps answering to this question would be good, Thanks!

  • 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-22T00:48:55+00:00Added an answer on May 22, 2026 at 12:48 am
    1. Something like this: preg_match('/\b[^"]/',$input_string);

      This looks for a word-break (\b), followed by any character other than a double quote ([^"]).

    2. Something like this: preg_match('~(((ThisShouldBePresent)://).+)~');

      I’ve assumed the brackets you specified in the question (and the plus sign) were intended as part of the regex rather than characters to search for.

      I’ve also taken @ThiefMaster’s advice and changed the delimiter to ~ to avoid having to escape the //.

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

Sidebar

Related Questions

I have strings that looks like this: John Miller-Doe - Name: jdoe Jane Smith
I have a strings that looks like this: wes-1 className Another wes-2-bos className Another
I have an PHP array of strings it looks like this Array ( [1]
I want to do preliminary check if entered string looks like Vehicle Identification Number
I have a string that looks like this: Name1=Value1;Name2=Value2;Name3=Value3 Is there a built-in class/function
So I was writing some code today that basically looks like this: string returnString
I have column that contains strings. The strings in that column look like this:
I have a set of strings with numbers embedded in them. They look something
I'm using a helper class to build my hyperlink. The markup looks like this:
My array looks like this: Array ( [Bob] => Red [Joe] => Blue )

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.