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 4009572
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:53:39+00:00 2026-05-20T08:53:39+00:00

I want to make a Regex pattern that matches all relative paths. What I

  • 0

I want to make a Regex pattern that matches all relative paths.

What I want to match:

<img src="image.png"
<img src="http_image.png"

What I don’t want to match:

<img src="http://example/image.png"

I tried matching with these patterns, but none of them work:

\src="[^http://]\
\src="^(http://)\
\src="[^h][^t][^t][^p][^:][^/][^/]\
\src="([^h][^t][^t][^p][^:][^/][^/])\

The src attribute will always be formatted with double-quotes ("), not single-quotes ('). It will always contain an "http" source, not "https" or others.

  • 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-20T08:53:40+00:00Added an answer on May 20, 2026 at 8:53 am

    The way to solve this is by using negative lookahead assertion:

    ^img src="(?!http:\/\/\S+).*"$
    

    Rubular link

    ^                  : Start anchor
    img src="          : Literal img src="
    (?!http:\/\/\S+)   : To ensure the string following " is not a URL
    .*                 : Anything else is allowed
    "                  : Literal "
    $                  : End anchor
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want a regex expression that will match; www http https It should make
I want to write a regex that matches a url that ends with .mp4
string: <something><or><other> regex pattern: <(\w+)><(\w+)><(\w+)> How do I make a regex call that returns
Long story short, I have two regex patterns. One pattern matches things that I
Say I want to make a regex that splits a optional version number from
The following code matches the two expressions and prints success. import java.util.regex.Matcher; import java.util.regex.Pattern;
My question for today is: How can I make function that could find all
I have a complex regex I want to apply. Here is my pattern: /(?:^|\s|[\.(\+\-\,])(?:\$?)\$((?:[0-9]+(?=[a-z])|(?![0-9\.\:\_\-]))(?:[a-z0-9]|[\_\.\-\:](?![\.\_\.\-\:]))*[a-z0-9]+)/i
I want to make this regex to support white spaces too but ( not
I have a regex pattern for URL's that I use to check for links

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.