Jump to content

Need Help With Regex.


Guest Travis

Recommended Posts

Oh cool thanks, that makes a lot of sense now. So I want to strip out the font code and make sure it doesn't match ^. or ^-. Could I do something like:

 

/^##\*.*\*##[^\.^-]/gS

 

You can use regex's negative look ahead:

/(?!\.|\^|-)##\*.*\*##/
If you mean that you want to ignore both the symbol "^." and "^-." This pattern should do the trick. The dot and the caret symbol are to be escaped because they have special meanings in regex. Edited by Fanfare
Link to comment
Share on other sites

Guest Travis

Alright I tried it but the expressions are $true for any text.

 

What I'm trying to do is convert Supertrivia for chatcore network. Supertrivia has 3 text events and I don't want to take the time to combine them into one text event. I'd like to just make this work how it is.

 

The problem is each text event uses regex to look at the first character of incoming text but this network has a font code for $1. So I need to look at the first character after the font code.

 

The first text event is supposed to check for text that starts with a . only.

on $*:text:/^(##\*.*\*##)?(.*)/:#:{ }


The second text event is supposed to check for text starting with ! only.

on $*:text:%st_filter_cmd:#:{ }

%st_filter_cmd = /^(##\*.*\*##)?(!*)/gS


The last text event checks for all text that doesn't start with a . or a !.

on $*:text:%st_filter_norm:#:{ }

%st_filter_norm = /(?!\.|\^|!)##\*.*\*##/gS

Can anyone please help me with the proper regex to do these things? Thank you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...