Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

Doug Davis 2024

@Doug Davis 2024
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • PHP perl regular expression - URL not preceded by equal sign and possible single or double quote
    D Doug Davis 2024

    I'm trying to create a perl regular expression that matches a URL that is not preceded by an equal sign and one single or double quote (optional) ignoring whitespace. The code below gives an error:

    Warning: preg_replace(): Compilation failed: lookbehind assertion is not fixed length at offset 0

    I know my URL regular expression isn't perfect, but I'm more focused on how to do the negative lookbehind or how to express this in some other way. For example, in the code below, I would like for the expression to match http://www.url1.com/ and http://www.url3.com/, but not the other URLs. How can I do this? The code below gives a warning and does not populate the $matches variable. The Code:

    $html = "
    http://www.url1.com/
    = ' http://www.url2.com/
    'http://www.url3.com/
    [Testing1](http://www.url4.com/)
    ![](https://url5.com)Testing2";
    
    $url\_pregex = '((http(s)?://)\[-a-zA-Z()0-9@:%\_+.~#?&;//=\]+)';
    $pregex = '(?
    

    Perl Regex in PHP, using ` instead of /:

    '`(?

    Regular Expressions regex tutorial question php perl
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups