473,396 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Perl/Python regular expressions vs. Boost.regex?

A colleague wrote a C++ library here at work which uses the Boost.regex
library. I quickly discovered an apparent problem with how it searches.
Unlike re.match the regex_match function in that library effectively anchors
the match at both the start and the end. Can other people confirm this?

Thx,

Skip Montanaro
Oct 23 '08 #1
2 2975
wrote in news:ma**************************************@pyth on.org in
comp.lang.python:
A colleague wrote a C++ library here at work which uses the
Boost.regex library. I quickly discovered an apparent problem with
how it searches. Unlike re.match the regex_match function in that
library effectively anchors the match at both the start and the end.
Can other people confirm this?

Thx,

Skip Montanaro
Quoting from : <url:http://www.boost.org/doc/libs/1_36_
0/libs/regex/doc/html/boost_regex/ref/regex_match.html>

<quote>
Important

Note that the result is true only if the expression matches the whole of
the input sequence. If you want to search for an expression somewhere
within the sequence then use regex_search. If you want to match a prefix of
the character string then use regex_search with the flag match_continuous
set.

</quote>

So yes it does.

Rob.
--
http://www.victim-prime.dsl.pipex.com/
Oct 23 '08 #2

RobQuoting from : <url:http://www.boost.org/doc/libs/1_36_0/libs/regex/doc/html/boost_regex/ref/regex_match.html>

Rob<quote>
RobImportant

RobNote that the result is true only if the expression matches the
Robwhole of the input sequence. If you want to search for an
Robexpression somewhere within the sequence then use regex_search. If
Robyou want to match a prefix of the character string then use
Robregex_search with the flag match_continuous set.

Rob</quote>

RobSo yes it does.

Thanks. I'll try and convince my colleague to use regex_search instead of
regex_match.

Skip

Oct 25 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: John Smith | last post by:
Hello, I have a rather odd question. My company is an all java/oracle shop. We do everything is Java... no matter what it is... parsing of text files, messaging, gui you name it. My question...
77
by: Hunn E. Balsiche | last post by:
in term of its OO features, syntax consistencies, ease of use, and their development progress. I have not use python but heard about it quite often; and ruby, is it mature enough to be use for...
17
by: Michael McGarry | last post by:
Hi, I am just starting to use Python. Does Python have all the regular expression features of Perl? Is Python missing any features available in Perl? Thanks, Michael
31
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is...
75
by: Xah Lee | last post by:
http://python.org/doc/2.4.1/lib/module-re.html http://python.org/doc/2.4.1/lib/node114.html --------- QUOTE The module defines several functions, constants, and an exception. Some of the...
9
by: Dieter Vanderelst | last post by:
Dear all, I'm currently comparing Python versus Perl to use in a project that involved a lot of text processing. I'm trying to determine what the most efficient language would be for our...
3
by: Boni | last post by:
Dear all, is it possible to use .NET or any other "build in" regular expressions libruary from native absolutely unmanaged C++ (no IJW no managed code). Thanks a lot, Boni
8
by: John Pye | last post by:
Hi all I have a file with a bunch of perl regular expressions like so: /(^|)\*(.*?)\*(|$)/$1'''$2'''$3/ # bold /(^|)\_\_(.*?)\_\_(|$)/$1''<b>$2<\/ b>''$3/ # italic bold...
1
by: Allan Ebdrup | last post by:
I have a dynamic list of regular expressions, the expressions don't change very often but they can change. And I have a single string that I want to match the regular expressions against and find...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.