Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Eugh, regex :(

by haoess (Curate)
on Mar 25, 2009 at 09:31 UTC ( #753066=note: print w/ replies, xml ) Need Help??

in reply to Eugh, regex :(

Please, post your real code. The error message says something about matching: ... =~ m%..., but your code is something about substitution, and it does not compile:

Substitution replacement not terminated at 753064 line 1.

-- Frank

Comment on Re: Eugh, regex :(
Select or Download Code
Replies are listed 'Best First'.
Re^2: Eugh, regex :(
by ultranerds (Friar) on Mar 25, 2009 at 09:36 UTC

    Thats all the code you should need.

    $post_message is just a text string, with the example I gave - and then it runs this:

    $post_message =~ s%\Q[URL=\E([\?\%\:\/a-zA-Z0-9_\-\.]+)\Q][img]\E([\?\%\:\/a-zA-Z0-9_\-\.]+)\Q[/img][/URL]\E%gix;

    (which is the line thats giving the error)

    Maybe its something to do with the regex?


      % cat 753064 $post_message =~ s%\Q[URL=\E([\?\%\:\/a-zA-Z0-9_\-\.]+)\Q][img]\E([\?\ +%\:\/a-zA-Z0-9_\-\.]+)\Q[/img][/URL]\E%gix; % perl -Mdiagnostics 753064 Substitution replacement not terminated at 753064 line 1 (#1) (F) The lexer couldn't find the final delimiter of an s/// or s{}{ +} construct. Remember that bracketing delimiters count nesting leve +l. Missing the leading $ from variable $s may cause this error. Uncaught exception from user code: Substitution replacement not terminated at 753064 line 1. at 753064 line 1

      The error message says it all, if you want to substitute, you should tell perl, whats your substitution is.

      -- Frank

        Oops, just saw that! Changed it, still getting errors :(

        It seems to be from this line still, cos if I comment it out - the rest of the script works fine:

        $post_message =~ s|\Q[img]\E([\?\%\:\/a-zA-Z0-9_\-\.]+)\Q[/img]\E|[img]$1[/img]|sig;
        (the above is just a more basic version of what I'm trying, to see if I can try and track down whats going on)

        Driving me nuts :(



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://753066]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2015-11-25 01:33 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (667 votes), past polls