This document provides an overview of strings in PHP. It discusses single and double quote strings and how they differ in handling escape sequences and variable interpolation. It also covers the heredoc syntax. The document explains functions for comparing, manipulating, and extracting substrings from strings. These include strcmp(), strlen(), substr(), and regular expression functions. It provides examples of escaping characters, accessing strings as arrays, and using strings with functions like number_format(). Overall, the document is a guide to the basics of strings and common string functions in PHP.
This is the fourth set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
This is the ninth set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
This is the third set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
This is the fourth set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
This is the ninth set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
This is the third set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
This is the second set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
Most developers will be familiar with lex, flex, yacc, bison, ANTLR, and other tools to generate parsers for use inside their own code. Erlang, the concurrent functional programming language, has its own pair, leex and yecc, for accomplishing most complicated text-processing tasks. This talk is about how the seemingly simple prospect of parsing text turned into a new parser toolkit for Erlang, and why functional programming makes parsing fun and awesome.
This is the seventh set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
Perl, a cross-platform, open-source computer programming language used widely in the commercial and private computing sectors. Perl is a favourite among Web developers for its flexible, continually evolving text-processing and problem-solving capabilities.
Lessons learned from years of maintaining/extending/improving an in house CMS. Hopefully these will present things to avoid and things to try that will save others some pain.
Understanding regular expressions gives developers another extremely useful and powerful tool they can use to perform some operations that would otherwise be very tedious or difficult. This presentation goes over how to build and test regular expressions so developers can start using them within their own code.
Iterators, ArrayAccess & Countable (Oh My!) - Madison PHP 2014Sandy Smith
Learn how to empower your objects in PHP with SPL! The SPL (Standard PHP Library) has existed for many years but is still one of the less understood parts of the language. We will cover some of the most useful core aspects of the SPL, features that are easy to add to your own objects, making them more powerful and flexible!
This is the second set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
Most developers will be familiar with lex, flex, yacc, bison, ANTLR, and other tools to generate parsers for use inside their own code. Erlang, the concurrent functional programming language, has its own pair, leex and yecc, for accomplishing most complicated text-processing tasks. This talk is about how the seemingly simple prospect of parsing text turned into a new parser toolkit for Erlang, and why functional programming makes parsing fun and awesome.
This is the seventh set of slightly updated slides from a Perl programming course that I held some years ago.
I want to share it with everyone looking for intransitive Perl-knowledge.
A table of content for all presentations can be found at i-can.eu.
The source code for the examples and the presentations in ODP format are on https://github.com/kberov/PerlProgrammingCourse
Perl, a cross-platform, open-source computer programming language used widely in the commercial and private computing sectors. Perl is a favourite among Web developers for its flexible, continually evolving text-processing and problem-solving capabilities.
Lessons learned from years of maintaining/extending/improving an in house CMS. Hopefully these will present things to avoid and things to try that will save others some pain.
Understanding regular expressions gives developers another extremely useful and powerful tool they can use to perform some operations that would otherwise be very tedious or difficult. This presentation goes over how to build and test regular expressions so developers can start using them within their own code.
Iterators, ArrayAccess & Countable (Oh My!) - Madison PHP 2014Sandy Smith
Learn how to empower your objects in PHP with SPL! The SPL (Standard PHP Library) has existed for many years but is still one of the less understood parts of the language. We will cover some of the most useful core aspects of the SPL, features that are easy to add to your own objects, making them more powerful and flexible!
Unicode regular expression tutorial with examples in Perl, PHP, and JavaScript.
Presented at: Shutterstock “Brown Bag Lunch” Tech Talk, 23 January 2013, New York, NY
Architecting with Queues for Scale, Speed, and Separation (DCPHP 3/11/15)Sandy Smith
You may know that queues can help with long-running tasks, but did you know they can help you make your application easier to debug, more performant, and scale in the cloud? Taking the real-world example of a contest app deployed on Azure, we'll see how easy queues can be to implement. You'll see how the smart use of queues can enable your application to handle many more users with the same code, break components across servers, and help you keep your app responsive.
Don't Fear the Regex - CapitalCamp/GovDays 2014Sandy Smith
Have you been scared off by Klingon-looking one-liners in Perl? Do you resort to writing complicated recursive functions just to parse some HTML? Don't!
I'll demystify regular expressions and show you how best to do them in PHP. We'll cover the syntax and functions that make PHP a great text-parsing language, and give you the foundation to learn more.
As a bonus, I'll give you two cases people often use as examples for regexes that PHP gives you better native ways to accomplish.
Given at CapitalCamp & GovDays 2014
GAIQ - Regular expressions-google-analytics; one of the best resources; concepts explained in a very easy to understand descriptive method with examples
Regular expressions are a concise way to search and transform strings using patterns. They are available in numerous text editors and programming languages.
Here, I introduce basic regular expressions and show the intermediate and advanced syntax which I use commonly. The second-to-last slide has a nice cheatsheet.
Related blog post: http://dafoster.net/articles/2013/09/04/regular-expressions/
Have you been scared off by Klingon-looking one-liners in Perl? Do you resort to writing complicated recursive functions just to parse some HTML? Don't!
I'll demystify regular expressions and show you how best to do them in PHP. We'll cover the syntax and functions that make PHP a great text-parsing language, and give you the foundation to learn more.
As a bonus, I'll give you two cases people often use as examples for regexes that PHP gives you better native ways to accomplish.
Architecting with Queues - Northeast PHP 2015Sandy Smith
You may know that queues can help with long-running tasks, but did you know they can help you make your application easier to debug, more performant, and scale in the cloud? Taking the real-world example of a contest app, we’ll see how easy queues can be to implement. You’ll see how the smart use of queues can enable your application to handle many more users with the same code, break components across servers, and help you keep your app responsive.
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
This PPT will help to understand how learning happens in brain. How you can adjust your skill acquisition in the right way so that maximum output is obtained.
Baabtra.com has a solution to provide programming for kids in school. This is based on the CBSE curriculum of India. The main subjects covered are Mathematics and Physics.
99LMS is a mobile based comprehensive enterprise learning environment in which learning processes of a company can be managed and integrated. It ensures employees have the right skills by enabling course content management, providing classroom training and e-learning. Through the APIs, you can develop your resources before they join your company.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
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.
Let's dive deeper into the world of ODC! Ricardo Alves (OutSystems) will join us to tell all about the new Data Fabric. After that, Sezen de Bruijn (OutSystems) will get into the details on how to best design a sturdy architecture within ODC.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
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.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
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
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.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
3. String basics
1. Single quote strings (‘ ’)
– single quotes represent ‚simple strings,‛ where almost all characters are
used literally
2. Double quote strings(‚ ‛)
– complex strings‛ that allow for special escape sequences (for example, to
insert special characters) and for variable substitution
$a=‚Baabtra‛;
echo ‘Hello $a’;
echo ‚Hello $a n welcome‛;
Hello $a
Hello baabtra
welcome
Out put
4. String basics - contd
• Clearly, this ‚simple‛ syntax won’t work in those situations in which the
name of the variable you want to interpolated is positioned in such a way
inside the string that the parser wouldn’t be able to parse its name in the
way you intend it to. In these cases, you can encapsulate the variable’s name
in braces
$me = ’Davey’;
$names = array (’Smith’, ’Jones’, ’Jackson’);
echo "There cannot be more than two {$me}s!";
echo "Citation: {$names[1]}[1987]";
5. String basics - contd
3. The Heredoc Syntax
used to declare complex strings, the functionality it provides is similar to double
quotes, with the exception that, because heredoc uses a special set of tokens to
encapsulate the string, it’s easier to declare strings that include many double-
quote characters.
$who = "World";
echo <<<TEXT
So I said, "Hello $who"
TEXT;
6. Escaping Literal Values
• All three string-definition syntax feature a set of several characters
that require escaping in order to be interpreted as literals.
echo ’This is ’my’ string’;
$a = 10;
echo "The value of $a is "$a".";
echo "Here’s an escaped backslash:";
7. String as arrays
• You can access the individual characters of a string as if they were
members of an array
$string = ’abcdef’;
echo $string[1]; // Outputs ’b’
}
8. String comparison == and ===
$string = ’123aa’;
if ($string == 123) {
// The string equals 123
}
• You’d expect this comparison to return false, since the two operands are not the
same. However, PHP first transparently converts the contents of $string to the
integer 123, thus making the comparison true.
• Naturally, the best way to avoid this problem is to use the identity operator ===
10. String functions –strcmp(), strcasecmp()
strcmp(), strcasecmp() both returns zero if the two strings passed to the
function are equal. These are identical, with the exception that the former is
case-sensitive, while the latter is not.
$str = "Hello World";
if (strcmp($str, "hello world") === 0) {
// We won’t get here, because of case sensitivity
}
if (strcasecmp($str, "hello world") === 0) {
// We will get here, because strcasecmp() is case-insensitive
}
11. String functions –strcasencmp()
strcasencmp() allows you to only test a given number of characters
inside two strings.
$s1 = ’abcd1234’;
$s2 = ’abcd5678’;
// Compare the first four characters
echo strcasencmp ($s1, $s2, 4);
13. String functions –strtr()
strtr() used to translate certain characters of a string into other
characters
• Single character version
echo strstr (’abc’, ’a’, ’1’);
• Multiple-character version
$subst = array (’1’ => ’one’,’2’ => ’two’);
echo strtr (’123’, $subst);
1bc
Out put
onetwo3
Out put
14. String functions –strpos()
• strpos() allows you to find the position of a substring inside a string. It
returns either the numeric position of the substring’s first occurrence within
the string, or false if a match could not be found.
• You can also specify an optional third parameter to strpos() to indicate that you
want the search to start from a specific position within the haystack.
$haystack = ’123456123456’;
$needle = ’123’;
echo strpos ($haystack, $needle);
echo strpos ($haystack, $needle, 1);
0
Out put
6
15. String functions –stripos() , strrpos()
• stripos() is case-insensitive version of strpos()
echo stripos(’Hello World’, ’hello’);
• Strpos() does the same as strpos(), but in the revers order
echo strrpos (’123123’, ’123’);
0
Out put
3
Out put
16. String functions –strstr()
• The strstr() function works similarly to strpos() in that it searches the main
string for a substring. The only real difference is that this function returns the
portion of the main string that starts with the sub string instead of the latter’s
position:
$haystack = ’123456’;
$needle = ’34’;
echo strstr ($haystack, $needle);
3456
Out put
17. String functions –stristr()
• stristr() is case-insensitive version of strstr()
echo stristr(’Hello My World’, ’my’); My World
Out put
18. String functions –str_replace(), str_ireplace()
• str_replace() used to replace portions of a string with a different substring
echo str_replace("World", "Reader", "Hello World");
• Str_ireplace() is the case insensitive version of str_replace()
echo str_ireplace("world", "Reader", "Hello World");
• Optionally, you can specify a third parameter, that the function fills, upon
return, with the number of substitutions made:
$a = 0;
str_replace (’a’, ’b’, ’a1a1a1’, $a);
echo $a;
Hello Reader
Out put
Hello Reader
Out put
3
19. String functions –str_replace(), str_ireplace()
• If you need to search and replace more than one needle at a time, you can pass the first
two arguments to str_replace() in the form of arrays
• echo str_replace(array("Hello", "World"), array("Bonjour", "Monde"), "HelloWorld");
• echo str_replace(array("Hello", "World"), "Bye", "Hello World");
Bye Bye
Hello Reader
20. String functions –substr()
• The very flexible and powerful substr() function allows you to extract
a substring from a larger string.
echo substr ($x, 0, 3); outputs 123
echo substr ($x, 1, 1); outputs 2
echo substr ($x, -2); outputs 67
echo substr ($x, 1); outputs 234567
echo substr ($x, -2, 1); outputs 6
21. String functions –number_format()
• Number formatting is typically used when you wish to output a
number and separate its digits into thousands and decimal points
• echo number_format("100000.698‚ , 3 , "," , ‚ ");
100 000,698
Number to be formatted
Number of decimal places to be rouned
decimal separator
Thousand separator
Output
23. Regular Expressions
• Perl Compatible Regular Expressions (normally abbreviated as
‚PCRE‛) offer a very powerful string-matching and replacement
mechanism that far surpasses anything we have examined so far.
• The real power of regular expressions comes into play when you
don’t know the exact string that you want to match
24. Regular Expressions - Delimiters
• A regular expression is always delimited by a starting and ending
character.
• Any character can be used for this purpose (as long as the
beginning and ending delimiter match); since any occurrence of
this character inside the expression itself must be escaped, it’s
usually a good idea to pick a delimiter that isn’t likely to appear
inside the expression.
25. Regular Expressions – Meta characters
• However, every metacharacter represents a single character in the
matched expression.
. (dot)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
26. Regular Expressions – Meta characters
• Meta characters can also be expressed using grouping expressions. For example, a
series of valid alternatives for a character can be provided by using square brackets:
/ab[cd]e/
• You can also use other metacharacters, and provide ranges of valid characters inside a
grouping expression:
/ab[c-ed]/
The expression will match abce or abde
This will match abc, abd, abe and any combination
of ab followed by a digit.
27. Regular Expressions – Quanitifiers
• This will match abc, abd, abe and any combination of ab followed by a digit.
* The character can appear zero or more times
+ The character can appear one or more times
? The character can appear zero or one times
{n,m} The character can appear at least n times, and no more than m.
Either parameter can be omitted to indicated a minimum limit
with nomaximum, or a maximum limit without aminimum,
but not both.
ab?c matches both ac and abc,
ab{1,3}c matches abc, abbc and abbbc.
Example
28. Regular Expressions – Sub-Expressions
• A sub-expression is a regular expression contained within the
main regular expression (or another sub-expression); you define
one by encapsulating it in parentheses:
/a(bc.)e/
/a(bc.)+e/
Example
29. Matching and Extracting Strings
• The preg_match() function can be used to match a regular
expression against a given string.
$name = "Davey Shafik";
// Simple match
$regex = "/[a-zA-Zs]/";
if (preg_match($regex, $name)) {
// Valid Name
}
Example
32. If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
33. Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com