Class mata::applications::strings::replace::ReluctantReplace¶
-
class ReluctantReplace
Implementation of all reluctant replace versions.
Public Static Functions
-
static Nft replace_regex(nfa::Nfa aut, const Word &replacement, Alphabet const *const alphabet, ReplaceMode replace_mode = ReplaceMode::All, Symbol begin_marker = BEGIN_MARKER)
Create NFT modelling a reluctant leftmost replace of regex represented by deterministic automaton
auttoreplacement.The most general replace operation, handling any regex as the part to be replaced.
- Parameters:
aut – Deterministic automaton representing regex to be replaced.
replacement – Literal to replace with.
alphabet – Alphabet over which to create the NFT.
replace_mode – Whether to replace all or just the single (the leftmost) occurrence of
regex.begin_marker – Symbol to be used internally as a begin marker of replaced
regex.
- Returns:
The reluctant leftmost replace NFT.
-
static Nft replace_literal(const Word &literal, const Word &replacement, Alphabet const *const alphabet, ReplaceMode replace_mode = ReplaceMode::All, Symbol end_marker = END_MARKER)
Create NFT modelling a reluctant leftmost replace of literal
literaltoreplacement.- Parameters:
literal – Literal to replace.
replacement – Literal to replace with.
alphabet – Alphabet over which to create the NFT.
replace_mode – Whether to replace all or just the single (the leftmost) occurrence of
literal.end_marker – Symbol to be used internally as an end marker marking the end of the replaced literal.
- Returns:
The reluctant leftmost replace NFT.
-
static Nft replace_symbol(Symbol from_symbol, Symbol replacement, Alphabet const *const alphabet, ReplaceMode replace_mode = ReplaceMode::All)
Create NFT modelling a reluctant leftmost replace of symbol
from_symboltoreplacement.
-
static Nft replace_symbol(Symbol from_symbol, const Word &replacement, Alphabet const *const alphabet, ReplaceMode replace_mode = ReplaceMode::All)
Create NFT modelling a reluctant leftmost replace of symbol
from_symboltoreplacement.
-
static Nft replace_regex(nfa::Nfa aut, const Word &replacement, Alphabet const *const alphabet, ReplaceMode replace_mode = ReplaceMode::All, Symbol begin_marker = BEGIN_MARKER)