Regular Expressions in Python
Regular expressions (regex) are patterns used to match character combinations in strings. They provide a concise way to search, extract, and manipulate text based on specific rules.
Using the re Module
Python's re module provides regex functionality:
import re
# Match a pattern at string start
match_result = re.match(r'pattern', 'input_string' ...
Posted on Thu, 13 Aug 2026 16:18:13 +0000 by laurton
String Extraction Techniques in MySQL Using Left, Right, Substring, and Substring_Index
Extracting Characters from the Left Side
Use left(source_text, char_count) to obtain a specified number of charcaters from the start of a string.
SELECT LEFT('datastream_process', 9);
-- Result: datastrea
Extracting Characters from the Right Side
Use right(source_text, char_count) to retrieve a defined number of characters from the end of a st ...
Posted on Wed, 12 Aug 2026 16:11:23 +0000 by SensualSandwich
Advanced AWK Text Processing Techniques
AWK Text Processing Fundamentals
Column Extraction and Field Separation
In AWK, you can reference columns using $0 (entire line) through $NF (last column). The following examples demonstrate column extraction:
# Display entire line
awk '{print}'
# Display first column
awk '{print $1}'
# Display second column
awk '{print $2}'
# Display las ...
Posted on Sun, 26 Jul 2026 16:15:07 +0000 by stlewis
Advanced sed Techniques for Text File Processing
sed Command Reference
Displaying Specific Lines
To print the 10th line of /etc/passwd:
sed -n '10p' /etc/passwd
To print lines 8 through 15 of /etc/passwd:
sed -n '8,15p' /etc/passwd
To print line 8 and the next 5 lines of /etc/passwd:
sed -n '8,+5p' /etc/passwd
Pattern Matching
To print lines starting with 'nginx' in /etc/passwd:
sed ...
Posted on Mon, 29 Jun 2026 16:09:36 +0000 by mescal
Understanding and Applying Regular Expressions in Linux
Regular expressions (regex) are patterns used to match character combinations in text, consisting of literal characters and metacharacters with special meanings. They enable efficient searching, extraction, and manipulation of text based on defined rules.
In Linux environments, regex is intergal to commend-line utilities like grep, sed, and awk ...
Posted on Sun, 21 Jun 2026 17:49:36 +0000 by andriy
Essential String Manipulation Techniques in Python
Combining Strings
Using the "+" Operator
The "+" operator allows concatenation of multiple strings.
str1 = "aaa"
str2 = "bbb"
result = str1 + str2
print(result)
# Output: aaabbb
Note that direct concatenation with non-string types is not allowed:
num = 100
str1 = "hello"
# print(str1 + num) # ...
Posted on Tue, 09 Jun 2026 18:08:58 +0000 by walnoot
Python Strings: Comprehensive Guide to Text Handling
Python Strings
Defining Strings
In Python, strings can be defined using single quotes (' '), double quotes (" "), or triple quotes (''' ''' or """ """). Triple quotes enable multi-line string definitions.
text_data = ' '
first_text = 'python'
second_text = "best"
third_text = ""&quo ...
Posted on Fri, 05 Jun 2026 18:03:19 +0000 by skip
Perl Programming Fundamentals for Beginners
Perl excels at text extraction, report generation, and system administration atuomation. Created during the late 1980s, it integrates capabilities from shell scripting, awk, and C. Administrators frequently deploy it for log analysis, while bioinformatics researchers rely on its pattern-matching strengths for genomic data processing.
Setting up ...
Posted on Sun, 24 May 2026 20:24:26 +0000 by baudday
Managing Empty Lines, Comments, Line Endings, and Duplicates in Vim
Removing Blank Lines
To delete all blank lines and those containing only whitespace:
:g/^$/d
To remove lines that contain only spaces or tabs:
:g/^\\s\*$/d
To eliminate lines starting with #, or with spaces or tabs followed by #:
:g/^\\s\*#/d
For PHP configuration files where comments start with ;:
:g/^\\s\*;/d
To delete lines from the second l ...
Posted on Wed, 20 May 2026 04:38:34 +0000 by yellowepi
Python File Handling Fundamentals and Advanced Operations
Overview
Data storage can be accomplished through databases or files. While databases maintain data integrity and relationships with enhanced security, file-based storage offers simplicity and ease of use for uncomplicated data structures without requiring database management systems.
Python provides several modules for file manipulation includ ...
Posted on Sun, 17 May 2026 19:03:16 +0000 by jbdphp