Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
StringTools[RegMatch] - determine if a string matches a regular expression
Calling Sequence
RegMatch(pattern, text, options)
Parameters
pattern
-
string; regular expression to match
text
string; text to test
options
(optional) name; subexpression substitution
Description
The RegMatch( pattern, text ) function determines whether a string text matches the regular expression pattern.
If the string text matches the regular expression specified by pattern, the value true is returned. If text does not match pattern, the value false is returned.
Note: If the pattern argument contains syntax errors, Maple may signal an error.
Up to nine names can be passed to RegMatch in the options parameter. Upon a successful match, the first of these symbols is assigned the substring of text that matches the entire regular expression pattern, and the remaining symbols are assigned the portions of text that match any parenthesized subexpressions, if any.
This function is part of the StringTools package, and so it can be used in the form RegMatch(..) only after executing the command with(StringTools). However, it can always be accessed through the long form of the command by using the form StringTools[RegMatch](..).
Examples
The following is a Maple implementation of the `grep' text searching tool.
In the following example, the matching string and substrings are assigned to names.
See Also
curry, readbytes, Regular_Expressions, select, string, StringTools, StringTools[Escape], StringTools[RegSubs], StringTools[Split]
Download Help Document