Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Changed Regex

Changed Regex

Changed Regex

I posted a regex question in thread

and you guys came up with the solution of


$str =~ s!\.(\d{4})!$1~~[1800..2030]?".<sup>$1</sup>":$&!ge; 

You also warned that Smartmatch was to be experimental and not to rely on the solution.
The regex has now stopped working and I find myself looking once again for a solution.

Is there a supported alternative to Smartmatch or can you suggest a different approach?


RE: Changed Regex


Which Perl version ?

The original code still works for me in Perl 5.18.2. Indeed now yells "Smartmatch is experimental at audiopro.pl line 7." to STDERR, but the regular expression is not affected and works as before. ( Getting rid of the warning by adding no warnings 'experimental::smartmatch';, results no visible difference compared to original functionality. )


RE: Changed Regex

I have recently moved the site to a new server which uses version 5.008008.

All I get is a 500 error when I run the previously working script, rather than a warning.
Not sure how to implement that 'no warnings' command but I would have thought that turning Warnings off altogether would give a similar result but still the 500 error.
I will knit a manual solution if it is going to be troublesome.


RE: Changed Regex

Thanks Feherke
I have created a workable solution so all is good now.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close