Name: HaxeVerbalExpressions
Owner: VerbalExpressions
Description: Verbal Expressions for Haxe
Created: 2016-01-05 08:57:12.0
Updated: 2017-10-27 12:21:26.0
Pushed: 2016-01-08 08:56:03.0
Homepage: null
Size: 22
Language: Haxe
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
VerbalExpressions is a Haxe library that helps to construct difficult regular expressions. Ported from the awesome JavaScript VerbalExpressions. This project wraps around the Haxe EReg class.
Clone the project or download the sources.
Basic usage of Verbal Expressions is trough new expressions.VerbalExpression()
:
myExpression = new expressions.VerbalExpression();
expression = new expressions.VerbalExpression()
tartOfLine()
hen("http")
aybe("s")
hen("://")
aybe("www.")
nythingBut(" ")
ndOfLine();
url = "https://www.haxe.org/";
est if the url matches
expression.isMatch(url)) {
ace('$url is a valid URL');
se {
ace('$url is an invalid URL');
e(expression.toString());
ogs the regular expression source: ^(http)(s)?(://)(www.)?([^{ }]*)$
ession.toRegex();
he Haxe EReg instance
result:String = new expressions.VerbalExpression()
.find("bird")
.replace("Replace bird with a duck", "duck");
e(result);
ogs "Replace duck with a duck"
This project has no external dependencies.
| Haxe target | status | |————-|——–| | Haxe interpreter | works | | C++ | works | | C# | works | | Java | compiles but has errors | | JavaScript | works | | Neko | works | | PHP | works | | Python | works | | Flash | works |
Note: Haxe is awesome! One codebase, many targets, no platform specific code.
You can find the documentation for the original JavaScript repo on their wiki. There can be some differences in the methods, but in general this documentation will cover most functions.
Clone the repo and fork! Pull requests are welcome.
Thank you to @jehna for coming up with the awesome original idea!