ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Character String and Byte String Processing →  Expressions and Functions for String Processing →  String Functions →  Description Functions for Character-Like Arguments → 

find, find_... - Search Functions

Syntax Forms

1. ... find( val = text  {sub = substring}|{regex = regex} [case = case]
            [off = off] [len = len] [occ = occ] ) ...

2. ... find_end( val = text regex = regex [case = case]
                [off = off] [len = len] [occ = occ] ) ...

3. ... find_any_of( val = text  sub = substring
                   [off = off] [len = len] [occ = occ] ) ...

4. ... find_any_not_of( val = text  sub = substring
                       [off = off] [len = len] [occ = occ] ) ...

Effect

The search functions find and find_... scan text for the characters specified in substring or for a match with a regular expression specified in regex, with the scanned subarea specified in the optional parameters off and len and the occurrence of the match specified in the optional parameter occ.

The return code has the type i and is filled as follows:

If a search is not successful, all functions return the value -1.

The optional parameters off, len, and occ have the following meaning when combined:

The occurrence of the match specified by occ refers to the search area defined by off and len.

Notes

Example

See String Functions, find and substring

Exceptions

Catchable Exceptions

CX_SY_RANGE_OUT_OF_BOUNDS

CX_SY_REGEX_TOO_COMPLEX

CX_SY_STRG_PAR_VAL