Converting lines to perl regex

I'm a complete failure when it comes to coding, at least when it comes to changing lines to regex. Is there a website I can use and plug in a line in order to convert it to code?

^Suddenly (\w+)'s movements through the time stream are slowed\.$


I know it's wrong, but where?

Comments

  • EnyalidaEnyalida Nasty Woman, Sockpuppeteer to the Gods
    Forgot a forward slash before the apostrophe, but that won't make it not match, afaik. Otherwise, that's not wrong. 
  • Converting to regex isn't very difficult, you just need to memorize a few basic rules and you can usually do all the regexing you need for a text game. The only regex converter I know is the one built into the MUSHClient trigger editting window.

    All you need to remember is to add ^ at the front of your line, a $ at the back of your line, and a \ before every single symbol. After you've done all that, then use (.*) to replace/match variables.

    Of course, using the (.*) wildcard can be irritatingly messy and won't work for more specific variable matching, but for starters, it should suffice. You already know (\w+), so it'll be simple to swap it out when you need to. You usually won't need anything much more complicated than that for a text game.

  • Your code looks fine to me, it's exactly what I use. Make sure you set the trigger type to perl regex, I know some people forget that.

    When I was first starting out I used this website to test my regex.
Sign In or Register to comment.