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

Functions

def fn (input, result)
 

Variables

string title
 
string pattern
 
string header = 'RESULT'
 
int testno = 0
 
 exp = ApgExp(pattern)
 
string input = '---abc___xyz+++'
 
string repl = '555'
 
 result = exp.replace(input, repl)
 

Function Documentation

◆ fn()

def examples.exp.replace.fn (   input,
  result 
)

Definition at line 88 of file replace.py.

Variable Documentation

◆ exp

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

Definition at line 34 of file replace.py.

◆ header

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

Definition at line 30 of file replace.py.

◆ input

string examples.exp.replace.input = '---abc___xyz+++'

Definition at line 35 of file replace.py.

◆ pattern

string examples.exp.replace.pattern
Initial value:
1 = '''start = X / Y
2 X = A B C
3 A = "a"
4 B = "b"
5 C = "c"
6 Y = 'xyz'
7 '''

Definition at line 20 of file replace.py.

◆ repl

string examples.exp.replace.repl = '555'

Definition at line 36 of file replace.py.

◆ result

examples.exp.replace.result = exp.replace(input, repl)

Definition at line 37 of file replace.py.

◆ testno

int examples.exp.replace.testno = 0

Definition at line 31 of file replace.py.

◆ title

string examples.exp.replace.title
Initial value:
1 = '''This example will demonstrate how replace matched
2 results. The replacements can be simple string replacements,
3 replacements with components of the result or with a custom
4 function for complex replacements.
5 '''

Definition at line 12 of file replace.py.

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