Ansicht
Dokumentation

ABENPCRE_ABEXA - PCRE ABEXA

ABENPCRE_ABEXA - PCRE ABEXA

General Data in Customer Master   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

Find a PCRE Regular Expression

The example demonstrates how to search for a regular expression in PCRE syntax.

Source Code

Execute

Description

In the example, a line of text and a regular expression can be entered. The program searches the text line text for the first match of the search pattern defined in the regular expression regex and highlights this section in the result display. The search expects a PCRE regular expression and is case-sensitive. The statement FIND is used to search the statement, while the statement REPLACE is used to mark the result. Here, the operator $0 serves as a placeholder for the match in the replacement text.

The predefined example text is:

"Cathy's cat with the hat sat on Matt's mat."

and the predefined regular expression is:

(\b.at\b)

The regular expression describes a word consisting of three characters, where the first is any single character and the other two are "at".

The case-sensitive search for the first occurrence finds the word "cat".

Note

The demonstration program DEMO_REGEX can be used to test regular expressions before using them in programs.






TXBHW - Original Tax Base Amount in Local Currency   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 1818 Date: 20240328 Time: 145815     sap01-206 ( 37 ms )