We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    I a building a plugin that replaces bible verse notations found in the content by a link (tooltip) that contains the actual scripture.
    I found a regular expression here: regexlob.com
    but that is not working with preg_match I have no idea how to construct a regex at all or how to use this one in php.
    on the site it works fine (pres the test button) but when I use it like this:

    <?php
    $input = "Het volgende hoofdstuk gaat over johannes3:16 dus nu moet je op deze text kunnen klikken." ;
    $patroon= '(?:\d|I{1,3})?\s?\w{2,}\.?\s*\d{1,}\:\d{1,}-?,?\d{0,2}(?:,\d{0,2}){0,2}';
    preg_match($patroon, $input, $matches);
    


    i get this error:
    Warning: preg_match() [function.preg-match]: Unknown modifier '?' in /var/www/vhosts/******.net/httpdocs/bijbel/boek.php on line 7
    


    what I need is that it finds "johannes3:16" from the input text.

    Dimmy
      follow me on twitter: @dimmy01
      • 7455
      • 2,204 Posts
      mm ok my mistake i forgot the delimiters in front en end of the expression

      Dimmy
        follow me on twitter: @dimmy01