easy to use Regex creator tool? [closed] - regex

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I tried some regex tools like Regulator, Regulazy & RegexBuddy. They don't do what I want and they expect the user to know regular expressions.
I want a tool for dummies. You tell the tool I need a regex for something like "match anything that ends with the word 'yes' and it contains at least one occurrence of the phrase '/test/'" and it creates the regex for you.
So I either enter my request in plain English or semi plain English or the tool has all kinds of ready made selections and I choose between them to create what I want ad hoc.
Is there such a tool which is geared towards non developers? I am not looking for a regex tester.

I have been a fan of Ultrapico's Expresso application. There is a builder section that helps you (a little) in building fragments of the expression. More importantly it will explain an existing expression (either your own or from the built in expression library) section by section.
It also includes a testing and replacement section to see and test your expressions. Lastly it will generate the expression formatted for either C#, C++, or VB.NET so that you know exactly how to insert the expression into your project.
Best of all it's free. I have been using this tool to help learn how regular expressions actually work, especially the complex ones. Can't say it makes writing expressions idiot proof but it has sure made learning expressions easier for me...
This tool was featured in a MSDN Webcast by Zain Naboulsi, and might be worth a watch. Hope this helps, and good luck with your Regex journey!

txt2re seems really good. I entered "This string contains test in it and ends in yes" into the box, clicked on test and yes, and
got a regular expression. It doesn't focus on teaching how to build regexes, but it shows you the perl code to parse what you need.
The real power of this tool is its ability to recognize things like dates, URLs, and tags. Whitespace didn't seem to work too well, however, and it doesn't appear to handle any sort of repetition.

Personally I really like Expresso http://www.ultrapico.com/Expresso.htm
The interface is quite clean - lets you test out search and replace functionality, has good help, plus it generates the C# expressions for you if you like.

For me, the best tool is RegexBuilder it's open source and writen in C#, so you can customize it as much as you want ;)
Enjoy. ;)

For web-based (one line only): http://txt2re.com/
For offline (Full text file is possible): Expresso

I like my own RegEx Builder best: http://www.linuxintro.org/regex

I am not sure such a tool exists, since they usually do the opposite:
Analyze a regexp and translate it in plain English.
The closest solution to your need would be this C# library, allowing you to program regexp in a semi-readable way:
Instead of this:
const string findGamesPattern =
#"<div\s*class=""game""\s*id=""(?<gameID>\d+)-game""(?<content>.*?)<!--gameStatus\s*=\s*(?<gameState>\d+)-->";
You would have, using ReadableRex:
Pattern findGamesPattern = Pattern.With.Literal(#"<div")
.WhiteSpace.Repeat.ZeroOrMore
.Literal(#"class=""game""").WhiteSpace.Repeat.ZeroOrMore.Literal(#"id=""")
.NamedGroup("gameId", Pattern.With.Digit.Repeat.OneOrMore)
.Literal(#"-game""")
.NamedGroup("content", Pattern.With.Anything.Repeat.Lazy.ZeroOrMore)
.Literal(#"<!--gameStatus")
.WhiteSpace.Repeat.ZeroOrMore.Literal("=").WhiteSpace.Repeat.ZeroOrMore
.NamedGroup("gameState", Pattern.With.Digit.Repeat.OneOrMore)
.Literal("-->");

I was also using Expresso, and found it quite good. The most important thing for me in these tools is validation and not so much visual aids for building expressions. I only need a tool to kind of remind me things, not design them for me.
Anyway, here's another free one, which I quite like. It's called Rad Software Regular Expression Designer. Hope this helps.

Try RegExr a flash based tool

If you are a mac person, try this widget, althought it's also a tester i find it quite useful as it's really easy to get to it while learning regex online
http://mac.softpedia.com/progDownload/Regex-Widget-Download-28467.html

I settled on RegexBuddy. It has a debugger, visualizer and translates the regex into plain English.

Well it's still very much a tool in development, but you could try Textpression at http://www.textpression.com Disclosure: I'm the author.
Textpression enables visual regex creation with a drag and drop editor; no regex syntax to learn! At time of writing Textpression is still in Alpha, but let me know what you think!

Intuitive Regular Expression Analyser and Composer Class (for PHP, Node/JS and Python), regex composer live example here
RegexAnalyser github repository
ps i am the author

As per details in your question, I think Regex Builder Tool is the exact tool you need.
For the regex you asked in question, you would give requirements in simple plain english like _Match_anywhere_in_text_ _zero_or_more_of_ ( _any_character_) _then_ _one_or_more_of_ ( _exact_string_ ( test)) _then_ _zero_or_more_of_ ( _any_character_) _then_ _exact_string_ ( yes) _then_ _end_of_line_
This would automatically generate regex .*test+.*yes$ You can also test generated regex right there using input like I did test, results yes & it would show that generated regex is matching the text as per your expectations.

Related

Is there a function to create a regex pattern from a string input?

I'm lousy at regular expressions but occasionally they're the only thing that's the right solution for a problem.
Is there something in the .NET framework that allows you to input an unencoded string and get a pattern from it? Which you could then modify as required?
e.g. I want to remove a CDATA section that contains a file from some XML but I can't work out what the right pattern is for <![CDATA[hugepileofrandombinarydataherethatalsoneedstogo]]> and I don't want to ask for help each time I'm stuck on a regex pattern.
Such tools exist, google by "regex generator".
But, as suggested in comments, better learn regex. Simple patterns are easy. Something like <!\[.*?]]>
in your case.
There are Regex Design tools like expresso...
http://www.ultrapico.com/expresso.htm
It's not perfect but as there is no suitable .Net component the text to regex page at txt2re.com is the best I've seen for those people who occasionally need to build a regex to match a string but don't have the time to relearn regex each time they want to use one.

Updating Textmate's Markdown Bundle URL Regex

Hey all, I'm looking to do pretty much what the title says. As-is, the seemingly favored Textmate Markdown bundle chokes on some URLs. What I'd like to do is implement #diegoperini's pattern to properly match URLs.
Some problems on my end: I suck with Regular Expressions, and I've never edited a Textmate bundle.
I'm not sure how to even explain what I'm trying. So essentially what I'm looking for is someone to point me in the right direction and help me along in getting this sorted out, and learn a bit more about Textmate and regex along the way.
Thanks so much.
I like to use Rubular.com for learning and testing Regex.
You want to use the Bundle Editor.
Read this.
Check out Textmate Screencasts.
You could also buy the Peepcode screencast on Textmate. It has some info about bundle editing that may be useful, although there's not huge amounts on what you want.
There is also a book
Good luck!

How to verify regexp patterns?

What are the common ways to verify the given regex pattern works well of the given scenario and check the results ?
I would like to know in general , not in the particular programming language and what is the best way to learn about writing regular expression ?
Books: Mastering Regular Expressions is the definitive guide to regular expressions. The Regular Expressions Cookbook is said to be lighter and more easily applicable.
Sites: Friedel's companion site is a good start. Regexlib is a source of idioms and patterns.
Software: RegexBuddy is a good, per pay, regex verifier.
I've used this resource when learning: http://www.regular-expressions.info/ and found myself going back there whenever there was something I needed to remember. It's very useful for learning and covers the basics very well. They also have various links to programs which can be used to verify regular expressions.
This is not a "real" verification, but RegexBuddy allows you to verify that your regex does what you expect it to do on any sample data you provide. It also translates the regex into an English description that can help to figure out mistakes. Plus, it knows all major regex flavors and can translate regexes between them.
For testing regular expression you can use RegEx Test tools like one below :
http://www.regextester.com/
To know more about how to learn regular expressions please check following SO threads :
Learning Regular Expressions
How to master Regular Expressions?
https://stackoverflow.com/questions/465119/how-do-i-learn-regular-expressions-closed
RAD Rexexp designer is a great tool
Set up an automated test using your tools of choice (because regex implementations vary from language to language and library to library) which applies the regex to a variety of both matching and non-matching inputs to verify that you get the correct results.
While RegexBuddy and the like may be helpful for initially creating the regex (or may not; I've never used them), you will still need to maintain it, just like any other code. When that time comes, it's vastly preferable to have a test script that will run through all your old test inputs (plus the new ones which created the need for the change) in a matter of seconds rather than having to sit on a website for tens of minutes, if not hours, trying to remember all your test inputs and manually re-run them to make sure you didn't break anything.

Regular expression extraction in text editors

I'm kind of new to programming, so forgive me if this is terribly obvious (which would be welcome news).
I do a fair amount of PHP development in my free time using pregmatch and writing most of my expressions using the free (open source?) Regex Tester.
However frequently I find myself wanting to simply quickly extract something and the only way I know to do it is to write my expression and then script it, which is probably laughable, but welcome to my reality. :-)
What I'd like is something like a simple text editor that I can feed my expression to (given a file or a buffer full of pasted text) and have it parse the expression and return a document with only the results.
What I find is usually regex search/replace functions, as in Notepad++ I can easily find (and replace) all instances using an expression, but I simply don't know how to only extract it...
And it's probably terribly obvious, can expression match only the inverse? Then I could use something like (just the expression I'm currently working on):
([^<]*)
And replace everything that doesn't match with nothing. But I'm sure this is something common and simple, I'd really appreciate any poniters.
FWIW I know grep and I could do it using that, but I'm hoping their are better gui'ified solution I'm simply ignorant of.
Thanks.
Zach
What I was hoping for would be something that worked in a more standard set of gui tools (ie, the tools I might already be using). I appreciate all the responses, but using perl or vi or grep is what I was hoping to avoid, otherwise I would have just scripted it myself (of course I did) since their all relatively powerful, low-level tools.
Maybe I wasn't clear enough. As a senior systems administrator the cli tools are familiar to me, I'm quite fond of them. Working at home however I find most of my time is spent in a gui, like Netbeans or Notepad++. I just figure there would be a simple way to achieve the regex based data extraction using those tools (since in these cases I'd already be using them).
Something vaguely like what I was referring to would be this which will take aa expression on the first line and a url on the second line and then extract (return) the data.
It's ugly (I'll take it down after tonight since it's probably riddled with problems).
Anyway, thanks for your responses. I appreciate it.
If you want a text editor with good regex support, I highly recommend Vim. Vim's regex engine is quite powerful and is well-integrated into the editor. e.g.
:g!/regex/d
This says to delete every line in your buffer which doesn't match pattern regex.
:g/regex/s/another_regex/replacement/g
This says on every line that matches regex, do another search/replace to replace text matching another_regex with replacement.
If you want to use commandline grep or a Perl/Ruby/Python/PHP one-liner any other tool, you can filter the current buffer's text through that tool and update the buffer to reflect the results:
:%!grep regex
:%!perl -nle 'print if /regex/'
Have you tried nregex.com ?
http://www.nregex.com/nregex/default.aspx
There's a plugin for Netbeans here, but development looks stalled:
http://wiki.netbeans.org/Regex
http://wiki.netbeans.org/RegularExpressionsModuleProposal
You might also try The Regulator:
http://sourceforge.net/projects/regulator/
Most regex engines will allow you to match the opposite of the regex.
Usually with the ! operator.
I know grep has been mentioned, and you don't want a cli tool, but I think ack deserves to be mentioned.
ack is a tool like grep, aimed at
programmers with large trees of
heterogeneous source code.
ack is written purely in Perl, and
takes advantage of the power of Perl's
regular expressions.
A good text editor can be used to perform the actions you are describing. I use EditPadPro for search and replace functionality and it has some other nice feaures including code coloring for most major formats. The search panel functionality includes a regular expression mode that allows you to input a regex then search for the first instance which identifies if your expression matches the appropriate information then gives you the option to replace either iteratively or all instances.
http://www.editpadpro.com
My suggestion is grep, and cygwin if you're stuck on a Windows box.
echo "text" | grep ([^<]*)
OR
cat filename | grep ([^<]*)
What I'd like is something like a
simple text editor that I can feed my
expression to (given a file or a
buffer full of pasted text) and have
it parse the expression and return a
document with only the results.
You have just described grep. This is exactly what grep does. What's wrong with it?

How can test I regular expressions using multiple RE engines? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Closed 8 years ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
How can I test the same regex against different regular expression engines?
The most powerful free online regexp testing tool is by far http://regex101.com/ - lets you select the RE engine (PCRE, JavaScript, Python), has a debugger, colorizes the matches, explains the regexp on the fly, can create permalinks to the regex playground.
Other online tools:
http://www.rexv.org/ - supports PHP and Perl PCRE, Posix, Python, JavaScript, and Node.js
http://refiddle.com/ - Inspired by jsfiddle, but for regular expressions. Supports JavaScript, Ruby and .NET expressions.
http://regexpal.com/ - powered by the XRegExp JavaScript library
http://www.rubular.com/ - Ruby-based
Perl Regex Tutor - uses PCRE
Windows desktop tools:
The Regex Coach - free Windows application
RegexBuddy recommended by most, costs US$ 39.95
Jeff Atwood [wrote about regular expressions]( post:).
Other tools recommended by SO users include:
http://www.txt2re.com/ Online free tool to generate regular expressions for multiple language (#palmsey another thread)
The Added Bytes Regular Expressions Cheat Sheet (#GateKiller another thread)
http://regexhero.net/ - The Online .NET Regular Expression Tester. Not free.
RegexBuddy
I use Expresso (www.ultrapico.com). It has a lot of nice features for the developer. The Regulator used to be my favorite, but it hasn't been updated in so long and I constantly ran into crashes with complicated RegExs.
Here are some for the Mac: (Note: don't judge the tools by their websites)
RegExhibit - My Favorite, powerful and easy
Reggy - Simple and Clean
RegexWidget - A Dashboard Widget for quick testing
If you are an Emacs user, the command re-builder lets you type an Emacs regex and shows on the fly the matching strings in the current buffer, with colors to mark groups. It's free as Emacs.
Rubular is free, easy to use and looks nice.
RegexBuddy is a weapon of choice
I use the excellent and free Rad Software Regular Expression Designer.
If you just want to write a regular expression, have a little help with the syntax and test the RE's matching and replacing then this fairly light-footprint tool is ideal.
couple of eclipse plugins for those using eclipse,
http://www.brosinski.com/regex/
http://www.bastian-bergerhoff.com/eclipse/features/web/QuickREx/toc.html
Kodos of course. Cause it's Pythonic. ;)
RegexBuddy is great!!!
I agree on RegExBuddy, but if you want free or when I'm working somewhere and not on my own system RegExr is a great online (Flash) tool that has lots of pre-built regex segments to work with and does real-time pattern matching for your testing.
In the standard Python installation there is a "Tools/scripts" directory containing redemo.py.
This creates an interactive Tkinter window in which you can experiment with regexs.
In the past I preferred The Regex Coach for its simplistic layout, instantaneous highlighting and its price (free).
Every once in awhile though I run into an issue with it when trying to test .NET regular expressions. For that, it turns out, it's better to use a tool that actually uses the .NET regular expression engine. That was my whole reason to build Regex Hero last year. It runs in Silverlight, and as such, runs off of the .NET Regex Class library directly.
Regexbuddy does all this. http://www.regexbuddy.com/
see the accepted answer to this question: Learning Regular Expressions
I'll add to the vote of Reggy for the Mac, gonna try out some of the other ones that Joseph suggested and upvote that post tomorrow when my limit gets reset.
for online: http://regexpal.com/
for desktop: The Regex Coach
+1 For Regex Coach here. Free and does the job really well.
http://www.weitz.de/regex-coach/
I am still a big The Regulator fan.
There are some stability problems but these can be fixed by disableing the Intellisense. It gets mad with some expressions and typos in building an expression.
Would love it if Roy Osherove updated, but looks like he is busy with other things.
I like to use this online one:
http://www.cuneytyilmaz.com/prog/jrx/
Of course, it'll be javascript regexp, but I've never yet done anything clever enough to notice the difference.
How much is your time worth? Pay the $40 and get RegexBuddy. I did, and I even upgraded from 2.x version to 3.x. It has paid for itself many times over.
I personally like the Regular Expression Tester.
It's a free firefox plugin, so always on!
Also this regex plugin can be useful for eclipse and idea users.
I like http://regexhero.net/tester/ a lot
Check out Regex Master which is free and open source regular expression tester
This regex tester able to test javascript, php and python
http://www.piliapp.com/regex-tester/
RegExBuddy so far I concur with and endorse.
RegExr for testing with the Actionscript 3 (whichever standard that may be)
http://rgx-extract-replace.appspot.com
has the functionality to enlist the captured regex groups formatted in columns and
optionally can replace the matched patterns in the input text.