Delphi Inspiration

Components and Applications

User Tools

Site Tools


products:pcre2:index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

products:pcre2:index [2017/03/15 13:01] (current)
Line 1: Line 1:
 +====== YuPcre2 ======
  
 +{{page>​header}}
 +
 +===== Overview =====
 +
 +YuPcre2 provides two matching algorithms, the standard Perl and alternative DFA algorithm:
 +
 +  * The **Perl** algorithm is what you are used to from Perl and JavaScript. It is fast and supports the complete pattern syntax. You will  likely be using it most of the time.
 +  * **DFA** is a special purpose algorithm. If finds all possible matches and, in particular, it finds the longest. It never backtracks and supports partial matching better, in particular multi-segment matching of very long subject strings.
 +
 +YuPcre2 has native interfaces for 8-bit, 16-bit, and 32-bit strings. Component wrappers are available for UnicodeString / WideString and AnsiString / Utf8String / RawBytestring:​
 +
 +^ Component ^ String Types ^ Comment |
 +^ {{TDIPerlRegEx2_16.png|TDIPerlRegEx2_16.png}} ''​TDIPerlRegEx2_16''​ | 16-bit strings:\\ UnicodeString,​ WideString | Full UTF-16 Unicode processing if coUtf CompileOption set. |
 +^{{TDIDfaRegEx2_16.png|TDIDfaRegEx2_16.png}} ''​TDIDfaRegEx2_16''​ | ::: | ::: |
 +^{{TDIPerlRegEx2_8.png|TDIPerlRegEx2_8.png}} ''​TDIPerlRegEx2_8''​ | 8-bit strings:\\ AnsiString, RawByteString,​ Utf8String | Full UTF-8 Unicode processing if coUtf CompileOption set.|
 +^ {{TDIDfaRegEx2_8.png|TDIDfaRegEx2_8.png}} ''​TDIDfaRegEx2_8''​ | ::: | ::: |
 +
 +{{ yupcre2_regex2_streamsearch.png?​250|Search Stream Demo Application}}The YuPcre2 RegEx2 classes descend from common ancestors which implement the core functionalities:​
 +
 +  * **Match** strings and and **extract** full or substring matches.
 +  * **Search** for regular expressions within streams and memory buffers. ''​TDIRegExSearchStream''​ descendants employ a buffered search within streams and files (of virtually unlimited size) and use little memory.
 +  * **Replace** full matches or partial substrings.
 +  * **List** full matches or partial substrings.
 +  * **Format** full matches or partial substrings by adding static or dynamic text.
 +
 +Users familiar with the [[products:​regex:​|DIRegEx]] might be interessted in the [[changes|differences]] between YuPcre2 and DIRegEx.
 +  ​
 +===== Pattern Syntax =====
 +
 +{{ YuPcre2_RegEx2_Workbench.gif?​250|YuPcre2 RegEx2 Workbench Application}} The YuPcre2 regular expression pattern syntax is mostly compatible with Perl. It includes the following:
 +
 +  * [[syntax#​quoting|Quoting]]
 +  * [[syntax#​escaped_characters|Escaped Characters]]
 +  * [[syntax#​character_types|Character Types]]
 +  * [[syntax#​general_category_properties_for_\p_and_\p|General Category Properties for \p and \P]]
 +  * [[syntax#​pcre2_special_category_properties_for_\p_and_\p|PCRE2 Special Category Properties for \p and \P]]
 +  * [[syntax#​script_names_for_p_and_p|Script Names for \p and \P]]
 +  * [[syntax#​character_classes|Character Classes]]
 +  * [[syntax#​quantifiers|Quantifiers]]
 +  * [[syntax#​anchors_and_simple_assertions|Anchors and Simple Assertions]]
 +  * [[syntax#​match_point_Reset|Match Point Reset]]
 +  * [[syntax#​alternation|Alternation]]
 +  * [[syntax#​capturing|Capturing]]
 +  * [[syntax#​atomic_groups|Atomic Groups]]
 +  * [[syntax#​comment|Comment]]
 +  * [[syntax#​option_setting|Option Setting]]
 +  * [[syntax#​newline_convention|Newline Convention]]
 +  * [[syntax#​what_\r_matches|What \R Matches]]
 +  * [[syntax#​lookahead_and_lookbehind_assertions|Lookahead and Lookbehind Assertions]]
 +  * [[syntax#​backreferences|Backreferences]]
 +  * [[syntax#​subroutine_references_possibly_recursive|Subroutine References (possibly recursive)]]
 +  * [[syntax#​conditional_patterns|Conditional Patterns]]
 +  * [[syntax#​backtracking_control|Backtracking Control]]
 +  * [[syntax#​callouts|Callouts]]
 +
 +===== YuPcre2 RegEx2 String Processing =====
 +
 +YuPcre2 can **Replace**,​ **List**, or **Format** regular expressions matches or any of its substrings, useful for text editors and word processors. Variable portions of the match can be included into the result text. The full match can be referenced by number, substrings also by name. The character to introduce these reference is freely configurable. FormatOptions allow to turn features on or off as required.
 +
 +  * ''​**Replace**''​ returns the original subject string with matches replaced, similar to but more flexible than Delphi'​s StringReplace() function.
 +  *  ''​**List**''​ collects all string matches into a single string. It extracts multiple phone numbers, e-mail addresses, or URLs, with a single call.
 +
 +===== YuPcre2 RegEx2 MaskControls =====
 +
 +{{ yupcre2_regex2_maskcontrols.png?​250|The YuPcre2 RegEx2 MaskControls Demo Application}}YuPcre2 includes two regular expression mask edits: ''​**TDIRegEx2MaskEdit**''​ and ''​**TDIRegEx2ComboBox**''​. Both controls validate keyboard input against a regular expression. They work similar to Delphi'​s TMaskEdit, but more flexible and powerful.
 +
 +The regular expression mask edits can:
 +
 +  * accept / reject specific characters at determined positions;
 +  * allow / reject particular characters if they follow defined character(s);​
 +  * restrict input text to begin / end with exact character(s);​
 +  * flag incomplete text to show that more input is needed.
 +
 +Examples: Numbers, number ranges, dates, phone numbers, e-mail addresses, URLs, currency, and more.
 +
 +{{tdiregex2maskedit.png |TDIRegEx2MaskEdit}} **TDIRegEx2MaskEdit**
 +
 +''​TDIRegEx2MaskEdit''​ is an edit control that validates keyboard input on a keystroke by keystroke basis. It accepts characters entered only if the new text matches the regular expression mask pattern. If the new text does not match, the character is silently rejected.
 +
 +{{tdiregex2maskcombobox.png |TDIRegEx2MaskComboBox}} **TDIRegEx2MaskComboBox**
 +
 +''​TDIRegEx2MaskComboBox''​ is a combo box control with essentially the same regular expression validation as ''​TDIRegEx2MaskEdit''​. Additionally,​ it allows to select values from the combobox drop down.
 +
 +===== Workbench Application =====
 +
 +The YuPcre2 RegEx2 Workbench helps to design and test regular expressions. It allows to set options, measure execution times, and to save and load settings for later use.
 +
 +The YuPcre2 RegEx2 Workbench is available as
 +
 +  * Design-Time Component Editor and
 +  * Standalone Application.
 +  ​
 +{{tag>"​pattern matching"​ pcre pcre2 perl posix regex "​regular expression"​ unicode}}
products/pcre2/index.txt · Last modified: 2017/03/15 13:01 (external edit)