RegexPal - regular expression tester dialog

Want to show off your scripts? Release them here and bask in the glory as the users give their opinions of your work.

Moderators: IRC Operators, Support Team, mIRC Gurus

Tom-
User
User
Posts: 159
Joined: Wed Apr 28, 2010 4:58 pm
Location: England
Contact:

RegexPal - regular expression tester dialog

Postby Tom- » Mon Apr 18, 2011 3:12 pm

I saw this site posted in #msl a while ago http://regexpal.com/. It is extremely useful if the need to write a regular expression for a massive line of text ever arises. Each parameter in $regex() can contain up to 4150 bytes, but this limitation applies to the overall length when echoing to test it.

But then what if the text you want to match is from a source like Google? There’s no support for regex matching bvars. So I wrote two aliases, $bregex() and $bregml(), to be used as the equivalent of $regex() and $regml() for bvars in this dialog.

They might be useful to perform matches in other scripts, although the downside is $bregex() is about 9x slower than $regex() - A LOT slower. It might be possible to tweak it to work faster, but it will never be as fast as $regex() for obvious reasons. Referencing can also be an issue - more so if the /g switch is used - due to the fact that some text may be matched twice. This is because to ensure that the matchtext is applied to the whole string, there is an overlap of 2000 characters. I’m probably not explaining it very well, but it can be seen in the script.

Syntax:
$bregex([name],&bvar,regular expression)
$bregml([name],N)

The script can be downloaded here: http://www.mediafire.com/?fpzrqr19g72ojoo
It’s not that big… But whether the expression matches the text or not is displayed through two images, so I had to upload it.

Image

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Updated: A few fixes for setting "" in vars - thanks Wims for pointing them out :P
___________________________________________
Image
• Owner/Scripter of Impact Bot
Arconiaprime
User
User
Posts: 1458
Joined: Fri May 18, 2007 12:29 am
Contact:

Re: RegexPal - regular expression tester dialog

Postby Arconiaprime » Mon Apr 18, 2011 9:08 pm

Would be a lot cooler to expand this to where the text actually gets highlighted when it matches :>

Nice work either way.
(Tim) Awong, the helpops are scaring me.
--------------------------------------------------------
SwiftIRC Services Administrator - 2010 - 2012
Owner: intrepid.il.us.SwiftIRC.net
FelicianoX
User
User
Posts: 40
Joined: Mon Dec 20, 2010 2:09 am

Re: RegexPal - regular expression tester dialog

Postby FelicianoX » Mon Apr 18, 2011 9:43 pm

Wow this is cool, thanks :>
Image
User avatar
JoshR
User
User
Posts: 716
Joined: Tue Jan 01, 2008 7:32 pm
Location: #mSL
Contact:

Re: RegexPal - regular expression tester dialog

Postby JoshR » Mon Apr 18, 2011 11:25 pm

Would also be cool to review the code without having to download it.
Image
User avatar
kerst
User
User
Posts: 4514
Joined: Wed Dec 27, 2006 9:51 am
Location: #msl

Re: RegexPal - regular expression tester dialog

Postby kerst » Thu May 12, 2011 1:33 pm

JoshR wrote:Would also be cool to review the code without having to download it.

He has quite some additions in his code which make downloading worthwile which cant be done easy in mSL
Its a script, not a Snippet.
Image
Steve's work

- Proscript -
R.I.P proscript

Return to “Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests