Pattern Clause Position Matching

For a number of different transform types, you can specify the limits at which any match is valid for a text string. In the diagram below, you can see how six different positional identifiers can be applied to pattern matching:

NOTE: Depending on the type of transform, some of these clauses are not available.

Positioning

Figure: Pattern Clause Positioning

Position ParameterDescriptionExample
afterIdentifies pattern or string after which the match is evaluated.

extract col:MySentence after:'eat '

Extracts: pizza on Fridays with my friends."

fromIdentifies pattern or string from which the match is evaluated. Any match includes the from clause pattern or string.

extract col:MySentence from:'eat '

Extracts: eat pizza on Fridays with my friends."

beforeIdentifies pattern or string before which the match is evaluated.

extract col:MySentence before:'friends'

Extracts: "I like to eat pizza on Fridays with my

toIdentifies pattern or string up to which the match is evaluated. Any match includes the to clause pattern or string.

extract col:MySentence to:'friends'

Extracts: "I like to eat pizza on Fridays with my friends

onIdentifies pattern or string in which the match may be found.

extract col:MySentence on:'Fridays'

Extracts: Fridays

atIdentifies the index of starting (x) and ending (y) characters in the string to match. In the above example, at:2,6 matches the string like.

extract col:MySentence at:2,6

Extracts: like

Pattern Parameter Interactions

The following table identifies the pattern parameters that can be matched with the parameter in the left column.

NOTE: The at parameter does not interact with any of the listed parameters.

Parameterafterfrombeforetoon
afterSee Note 1.No.before or tobefore or toYes. Can include before.
fromNo.See Note 1.before or tobefore or toNo.
beforeafter or fromafter or fromSee Note 1.No.Yes. Can include after.
toafter or fromafter or fromNo.See Note 1.No.
onYes. Can include before.No.Yes. Can include after.No.
  • Note 1: If there is no other pattern parameter in the transform, the maximum number of matches per cell is 1. If there is a matching parameter, more matches per cell can be found.
Was this page helpful? Let us know how we did:

Send feedback about...

Google Cloud Dataprep Documentation