Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/VerbalExpressions/QtVerbalExpressions
https://github.com/VerbalExpressions/QtVerbalExpressions
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/VerbalExpressions/QtVerbalExpressions
- Owner: VerbalExpressions
- License: other
- Created: 2013-09-07T09:45:45.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-02-08T19:09:10.000Z (over 9 years ago)
- Last Synced: 2024-05-02T16:09:13.676Z (6 months ago)
- Language: C++
- Size: 166 KB
- Stars: 61
- Watchers: 21
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-qt - QtVerbalExpressions - Qt Regular Expressions made easy. (Libraries.)
- awesome-qt - QtVerbalExpressions - Create regular expressions using natural English expressions. Part of the [VerbalExpressions](https://verbalexpressions.github.io) project, which does the same thing for a wide variety of languages. (Libraries / New Functionality)
README
[![Qt Pods](http://qt-pods.org/assets/logo.png "Qt Pods")](http://qt-pods.org)
QtVerbalExpressions
===================## Qt Regular Expressions made easy
This Qt lib is based off of the C++ [VerbalExpressions](https://github.com/VerbalExpressions/CppVerbalExpressions) library by [whackashoe](https://github.com/whackashoe).
### Testing if we have a valid URL
```cpp
auto expression = QVerbalExpressions()
.searchOneLine()
.startOfLine()
.then("http")
.maybe("s")
.then("://")
.maybe("www.")
.anythingBut(" ")
.endOfLine();qDebug()
<< expression // ^(?:http)(?:s)?(?:://)(?:www.)?(?:[^ ]*)$
<< expression.test("https://www.google.com"); // true
```##API
### Terms
* .anything()
* .anythingBut(const QString& value)
* .something()
* .somethingBut(const QString& value)
* .endOfLine()
* .find(const QString& value)
* .maybe(const QString& value)
* .startOfLine()
* .then(const QString& value)### Special characters and groups
* .any(const QString& value)
* .anyOf(const QString& value)
* .br()
* .lineBreak()
* .range(const std::initializer_list& args)
* .tab()
* .word()### Modifiers
* .withAnyCase()
* .searchOneLine()
* .searchGlobal()### Functions
* .replace(const QString& source, const QString& value)
* .test()### Other
* .add(expression)
* .multiple(const QString& value)
* .alt()