Version 1.0
Copyright © 2022 Lowell D. Thomas
Python APG
 … an ABNF Parser Generator
Variables
examples.exp.split Namespace Reference

Variables

string title
 
string pattern = 'start = %s"The entire string."\n'
 
string pat = 'PATTERN'
 
string header = 'RESULT'
 
int testno = 0
 
 exp = ApgExp(pattern)
 
string input = ''
 
 result = exp.split(input)
 

Variable Documentation

◆ exp

examples.exp.split.exp = ApgExp(pattern)

Definition at line 41 of file split.py.

◆ header

string examples.exp.split.header = 'RESULT'

Definition at line 37 of file split.py.

◆ input

string examples.exp.split.input = ''

Definition at line 42 of file split.py.

◆ pat

string examples.exp.split.pat = 'PATTERN'

Definition at line 36 of file split.py.

◆ pattern

string examples.exp.split.pattern = 'start = %s"The entire string."\n'

Definition at line 35 of file split.py.

◆ result

examples.exp.split.result = exp.split(input)

Definition at line 43 of file split.py.

◆ testno

int examples.exp.split.testno = 0

Definition at line 38 of file split.py.

◆ title

string examples.exp.split.title
Initial value:
1 = '''This example will demonstrate how to use
2 the split function. This function is similar to the
3 JavaScript string split function
4 (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)
5 with a regex expression for the split pattern.
6 All flags except the character code flag "c" are ignored.
7 If the "c" flag is set, substitute "tuple of character codes" for string.
8  - if the input string is empty, the output list contains
9  a single empty string
10  - if the pattern matches the entire string, the output list contains
11  a single empty string.
12  - if no pattern matches are found in the input string,
13  the output list contains a single string which
14  is a copy of the input string.
15  - if the pattern finds multiple matches, the output list contains
16  a each of the strings between the matches
17  - if the pattern matches the empty string, the output will be a list
18  of the single characters.
19 '''

Definition at line 13 of file split.py.

Python APG, Version 1.0, is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.