Python Fundamental Series from Data Science &; Data Analysis Path MySkill.id Source: Regular Advance Expression Python | by My Skill | Medium

Review of Regular Expressions in Python Programming Language (Python RegEx)

In the world of Information Technology, especially in the creation of an application and data processing involving a program code written by a developer by utilizing a programming language, especially its use in string processing, the concept of Regular Expressions (RegEx) is one of the concepts whose role is very supportive of an activity in making a program with the aim of string processing.

Regular Expression (RegEx) is a formal language used to describe search patterns on a given string. This certainly allows a developer and Data Analyst to search, match, and manipulate a string based on certain desired patterns. Python Programming Language as one of the popular programming languages and often used in an era where technological development has been very rapid as it is today, of course, provides complete support and services for the use of Regular Expression (RegEx) or better known as Python RegEx, through the use of the 're' module.

Regular Expression (RegEx) in Python programming language or better known as Python RegEx. Source: DQLab

Regular Expression (RegEx) in Python programming language or better known as Python RegEx. Source: DQLab

It is expected to read the two articles below to help make it easier to learn Python Regular Advance Expressions, so that it can provide maximum results. Both articles discuss Python Regular Expression (can be accessed via the following link: https://medium.com/@myskill.id/regular-expression-python-84a2468f5d88) and Regular Exspression: Search, Match and find all (can be accessed via the following link: https://medium.com/@myskill.id/regular-expression-search-match-and-find-all-d692481c8394)

Alternation (Substitute) in Python RegEx

In the Python programming language, especially in the concept of Regular Expressions or known as Python RegEx, there is an advanced material from Python RegEx itself, one of which is Alternation (Substitute). Alternation in Python RegEx refers to the use of an '|' operator (vertical line) to match one of several patterns that may exist in a given text. Of course, this allows a Python programming language user to use Python RegEx to match text containing one of several predefined keywords or patterns.

Example of Using Alternation (Substitute) on Python RegEx concept in Python programming language. Source : pythontutorial.net

Example of Using Alternation (Substitute) on Python RegEx concept in Python programming language. Source : pythontutorial.net

Alternation (Substitute) has a very useful benefit when we need to match a string that contains one of several keywords (keywords) or patterns that may exist in the given text (string). So this allows us to match a text or data that is certainly flexible and look for keywords or patterns that are optional in the given string.

Alternation can also be used in substitutions or modifiers of a text. For example, in regular expressions in Python we can use 're.sub()' to replace or change every occurrence of the word "black" or "white" in every string containing the word element "color" with the pattern 'r''black|white'.

String splitting in Python RegEx

In addition to the concept of Alternation (Substitute), there are several other concepts that regulate the use of Regular Expressions in the Python programming language, especially in the concept of Regular Expressions or known as Python RegEx. In Python RegEx, a developer or programmer can split a given string into various types of chunks smaller than the initial string using the ''method. So, we can do it with (with) or without (without) using regular expressions or Regular Expressions (RegEx) in Python RegEx (of course this is optional and according to the needs and effectiveness of use).split()

Example of Using Alternation Splitting String on Python RegEx concept in Python programming language. Source: PYnative.com

Example of Using Alternation Splitting String on Python RegEx concept in Python programming language. Source: PYnative.com

Advantages of the 'with method using Regular Expression (RegEx) in the Python programming language:split()