VerbalExpressions/HaxeVerbalExpressions

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Haxe VerbalExpressions

Build Status

Haxe Regular Expressions made easy

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.

Getting started

Clone the project or download the sources.

Basic usage of Verbal Expressions is trough new expressions.VerbalExpression():

myExpression = new expressions.VerbalExpression();
Examples
Testing valid URLs
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
Replacing strings
result:String = new expressions.VerbalExpression()
.find("bird")
.replace("Replace bird with a duck", "duck");

e(result); 
ogs "Replace duck with a duck"
Dependencies

This project has no external dependencies.

Status

| 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.

API documentation

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.

Contributions

Clone the repo and fork! Pull requests are welcome.

Credits

Thank you to @jehna for coming up with the awesome original idea!


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.