Welcome to SRL-Python’s documentation!¶
SRL-Python is Simple Regex Language library for Python. SRL-Python is pure Python, and has no other dependencies. SRL-Python supports for Python 2.7/3.3/3.4/3.5 and pypy.
Usage¶
Here is a short example, to illustrate the flavor of srl
:
>>> from srl import SRL
>>> srl = SRL('digit exactly 3 times')
>>> srl.pattern
'[0-9]{3}'
>>> srl.findall('0 01 012 013')
['012', '013']
Contents¶
API¶
This part of the documentation covers all the interfaces of SRL-Python.
SRL Object¶
srl¶
This module implements Simple Regex Language object.
copyright: |
|
---|---|
license: | MIT, see LICENSE for more details. |
-
class
srl.srl.
SRL
(srl=None)¶ The SRL object implements Simple Regex Language and acts as central object. It is passed the string represented for Simple Regex Language. Once it is created it will act almost exactly same behavior as re.RegexObject.
Usually you create a
SRL
instance like this:from srl import SRL srl = SRL('letter from a to f')
Parameters: srl – the string of Simple Regex Language -
__getattr__
(method)¶ SRL shares the same API with
re.RegexObject
.:>>> srl = SRL('digit exactly 3 times') >>> assert srl.match('012').group(0) == '012'
-
__str__
()¶ str(srl): regex pattern of compiled Simple Regex Language.:
>>> srl = SRL('digit exactly 3 times') >>> assert str(srl) == '[0-9]{3}'
-
srl.builder¶
This module implements the builder of Simple Regex Language.
copyright: |
|
---|---|
license: | MIT, see LICENSE for more details. |
srl.parsers.parser¶
This module implements Simple Regex Language parser.
copyright: |
|
---|---|
license: | MIT, see LICENSE for more details. |
License¶
MIT License
Copyright (c) 2016 Simple Regex Language
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.