This PPT explains, how to use regular expressions in PHP. PHP has two types of regular expressions Perl Style and Posix Style.
Read detailed tutorials on http://programmerblog.net
From my November 3, 2011 talk at MNPHP. Regular expressions are a powerful tool available in nearly every programming language or platform, including PHP. I go over the history of POSIX vs. PCRE, examples in PHP, and optimizations on how to write faster expressions.
PT.BUZOO INDONESIA is No1 Japanese offshore development company in Indonesia.
We are professional of web solution and smartphone apps. We can support Japanese, English and Indonesia.
We are hiring now at http://buzoo.co.id/
From my November 3, 2011 talk at MNPHP. Regular expressions are a powerful tool available in nearly every programming language or platform, including PHP. I go over the history of POSIX vs. PCRE, examples in PHP, and optimizations on how to write faster expressions.
PT.BUZOO INDONESIA is No1 Japanese offshore development company in Indonesia.
We are professional of web solution and smartphone apps. We can support Japanese, English and Indonesia.
We are hiring now at http://buzoo.co.id/
Become a deft manipulator of text data. Regular Expression is the miracle of text extraction. If you got a text patten in mind, you can write your own pattern match in regular expression.
Regular Expressions: every developer's best friend and worst nightmare! Join Andrei Zmievski, PHP developer and author of the PHP Regex (PCRE) extension, on a journey that will take you from your first steps into the world of regular expressions to the mastery of this most useful of tools. A must for everyone who's ever wondered what /(?=\d+)bar/ means.
Become a deft manipulator of text data. Regular Expression is the miracle of text extraction. If you got a text patten in mind, you can write your own pattern match in regular expression.
Regular Expressions: every developer's best friend and worst nightmare! Join Andrei Zmievski, PHP developer and author of the PHP Regex (PCRE) extension, on a journey that will take you from your first steps into the world of regular expressions to the mastery of this most useful of tools. A must for everyone who's ever wondered what /(?=\d+)bar/ means.
Ciarán Walsh's PHPNW08 slides:
In the right hands regular expressions can be a powerful tool, but it’s also far too easy for them to be used badly, or in the wrong situations.
This talk will kick off with a look at alternatives to regular expressions, for when the power of pattern matching is not required, and will also go over some cases when there are better alternatives available.
Then there will be a brief refresher on pattern syntax and some general tips and tricks to help when constructing regular expressions, before we go on to look at some situations where the use of pattern matching is a good fit, how to solve some common problems, and some common pitfalls when writing patterns.
Oracle database supports perl- and POSIX-compatible regular expressions with five elegant and powerful functions: REGEXP_REPLACE, REGEXP_SUBSTR, REGEXP_INSTR, REGEXP_LIKE, and REGEXP_COUNT.
This session will demonstrate their nuances and how to use them effectively for data cleansing, manipulation and selection, for validating things such as Social Security Numbers, credit cards, IP addresses, phone numbers, DNAs, XMLs, for extracting things such as email-ids, hostnames from URLs and strings, and for transposing delimited columns to rows. There will be a demo of a few tricky examples taken from forums.oracle.com and asktom.oracle.com.
The session will end with fuzzy matching and optimization techniques, and things to watch out for.
http://docs.oracle.com/cd/E11882_01/appdev.112/e25518/adfns_regexp.htm
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
2. Programmer Blog http://programmerblog.net
Regular Expressions in PHP
Regular Expressions
Regular expressions provide the foundation for describing or matching data according to
defined syntax rules. A regular expression is nothing more than a pattern of characters itself,
matched against a certain parcel of text.
PHP offers functions specific to two sets of regular expression functions, each
corresponding
to a certain type of regular expression: POSIX and Perl-style.
Regular Expression Syntax (POSIX)
3. Programmer Blog http://programmerblog.net
Regular Expressions in PHP
Quantifiers
The frequency or position of bracketed character sequences and single characters can be denoted by a
special character, with each special character having a specific connotation. The +, *, ?, {occurrence_range}
The frequency or position of bracketed character sequences and single characters can be denoted by a
special character, with each special character having a specific connotation. The +, *, ?,
{occurrence_range} , and $
Brackets
Brackets ([]) have a special meaning when used in the context of regular expressions, which are used to
find a range of characters.
The regular expression [php] will find any string containing the character p or h
[0-9] matches any decimal digit from 0 through 9.
[a-z] matches any character from lowercase a through lowercase z.
[A-Z] matches any character from uppercase A through uppercase Z.
[A-Za-z] matches any character from uppercase A through lowercase z.
p+ matches any string containing at least one p.
p* matches any string containing zero or more p’s.
p? matches any string containing zero or one p.
p{2} matches any string containing a sequence of two p’s.
p{2,3} matches any string containing a sequence of two or three p’s.
4. Programmer Blog http://programmerblog.net
Regular Expressions
p{2,} matches any string containing a sequence of at least two p’s.
p$ matches any string with p at the end of it.
Still other flags can precede and be inserted before and within a character sequence:
^p matches any string with p at the beginning of it.
[^a-zA-Z] matches any string not containing any of the characters ranging from a
through z and A through Z.
p.p matches any string containing p, followed by any character, in turn followed by
another p.
^.{2}$ matches any string containing exactly two characters.
<b>(.*)</b> matches any string enclosed within <b> and </b> (presumably HTML bold tags).
p(hp)* matches any string containing a p followed by zero or more instances of the sequence hp.
Search for these special characters in strings
The characters must be escaped with a backslash (). For example, if you wanted to search for a dollar
amount, a plausible regular expression would be as follows: ([$])([0-9]+); that is, a dollar sign followed by
one or more integers.
$42, $560, and $3.
Predefined Character Ranges (Character Classes)
For your programming convenience, several predefined character ranges, also known as character
classes, are available.
[:alpha:]: Lowercase and uppercase alphabetical characters. This can also be specified as [A-Za-z].
5. Programmer Blog http://programmerblog.net
Regular Expressions
Regular Expression Will match...
foo The string "foo"
^foo "foo" at the start of a string
foo$ "foo" at the end of a string
^foo$ "foo" when it is alone on a string
[abc] a, b, or c
[a-z] Any lowercase letter
[^A-Z] Any character that is not a uppercase letter
(gif|jpg) Matches either "gif" or "jpeg"
[a-z]+ One or more lowercase letters
[0-9.-] Аny number, dot, or minus sign
^[a-zA-Z0-9_]{1,}$ Any word of at least one letter, number or _
([wx])([yz]) wy, wz, xy, or xz
[^A-Za-z0-9] Any symbol (not a number or a letter)
([A-Z]{3}|[0-9]{4}) Matches three letters or four numbers
6. Programmer Blog http://programmerblog.net
Regular Expressions
Regular Expression Syntax (Perl Style)
The developers of PHP felt that instead of reinventing the regular expression wheel, so to speak, they
should make the famed Perl regular expression syntax available to PHP users, thus the Perl-style functions.
. Match any character
ˆ Match the start of the string
$ Match the end of the string
s Match any whitespace character
d Match any digit
w Match any “word” character
A: Matches only at the beginning of the string.
b: Matches a word boundary.
B: Matches anything but a word boundary.
A caret (^) character at the beginning of a regular expression indicates that it must match the beginning of
the string.
The dot (.) metacharacter matches any single character except newline (). So, the pattern h.t matches hat,
hothit, hut, h7t, etc.
The vertical pipe (|) metacharacter is used for alternatives in a regular expression. It behaves much like a
logical OR operator
7. Programmer Blog http://programmerblog.net
Regular Expressions
The metacharacters +, *, ?, and {} affect the number of times a pattern should be matched.
+ means "Match one or more of the preceding expression", * means "Match zero or more of the preceding
expression",
? means "Match zero or one of the preceding expression".
Curly braces {} can be used differently. With a single integer,
{n} means "match exactly n occurrences of the preceding expression", with one integer and a comma, {n,}
means "match n or more occurrences of the preceding expression", and with two comma-separated integers
{n,m} means "match the previous character if it occurs at least n times, but no more than m times".
/food/
Notice that the string food is enclosed between two forward slashes. Just like with POSIX regular
expressions, you can build a more complex string through the use of quantifiers:
/fo+/
This will match fo followed by one or more characters. Some potential matches include
food, fool, and fo4
PHP’s Regular Expression Functions (Perl Compatible)
preg_grep()
array preg_grep (string pattern, array input [, flags])
The preg_grep() function searches all elements of the array input, returning an array consisting of
all elements matching pattern.
8. Programmer Blog http://programmerblog.net
Regular Expressions
$foods = array("pasta", "steak", "fish", "potatoes");
$food = preg_grep("/^p/", $foods);
print_r($food);
preg_match()
int preg_match (string pattern, string string [, array matches]
[, int flags [, int offset]]])
The preg_match() function searches string for pattern, returning TRUE if it exists and FALSE
otherwise. The optional input parameter pattern_array can contain various sections of the
subpatterns contained in the search pattern
<?php
$line = "Vim is the greatest word processor ever created!";
if (preg_match("/bVimb/i", $line, $match)) print "Match found!";
?>
preg_match_all()
int preg_match_all (string pattern, string string, array pattern_array
[, int order])
The preg_match_all() function matches all occurrences of pattern in string, assigning each occurrence to
array pattern_array in the order you specify via the optional input parameter order.
9. Programmer Blog http://programmerblog.net
Regular Expressions
preg_replace_callback()
mixed preg_replace_callback(mixed pattern, callback callback, mixed str
[, int limit])
Rather than handling the replacement procedure itself, the preg_replace_callback() function delegates the
string-replacement procedure to some other user-defined function.
preg_split()
array preg_split (string pattern, string string [, int limit [, int flags]])
The preg_split() function operates like pattern can also be defined in terms of a regular expression.
<?php
$delimitedText = "+Jason+++Gilmore+++++++++++Columbus+++OH";
$fields = preg_split("/+{1,}/", $delimitedText);
foreach($fields as $field)
echo $field."<br />";
?>
OUTPUT:
Jason
Gilmore
Columbus
OH