기본 콘텐츠로 건너뛰기 보완적인 콘텐츠로 건너뛰기

Working with regular expressions

Regular expression can be used with the regex functions. This section contains example of some useful expressions.

General expressions

This example removes special characters from a string. Special characters are everything that is not a-z or 1-9.

{ regexReplace: {$.getCompany.URL}, "[^\w\s\-_]", "" }

This example removes special characters from a string but keeps characters with accents.

{ regex_replace: {$.companyname}, "[^A-Za-zÀ-ÖØ-öø-ÿ ]" , "" }

This example replaces a special character—the German "ß"—with a double "s".

{ regex_replace: {$.companyname}, "ß" , "ss"}

Names

These examples parse the first and last name from a full name, where the name format is "FirstName" "LastName".

Get first name:

{ regexparse:{$.fullname}, '^([^\s]*)' }

Get last name:

{ regexparse:{$.fullname}, '^[^\s]*\s(.*)' }

Addresses

This example parses the house number from a street address, where the format is "StreetName" "HouseNumber".

Get the house number:

{regexparse: 'Grauwpoort 1A-5, 9000 Gent', '([0-9]+[^ ,\n]*)'}

Phone numbers

This example removes all special characters from a phone number.

{regex_replace: {$.phone}, "([^\S]|[^0-9+])",""}

URLs and domain names

This example parses the path from a full URL, where the URL has a .com domain.

{ regexparse:{$.getCompany.url}, "\.com(.*)" }

Get the filename part of a URL:

{regexparse: {$.url}, '(?:.+\/)(.+)'}

이 페이지가 도움이 되었습니까?

이 페이지 또는 해당 콘텐츠에서 오타, 누락된 단계 또는 기술적 오류와 같은 문제를 발견하면 개선 방법을 알려 주십시오!