473,372 Members | 1,414 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,372 software developers and data experts.

C regex equiv to Python implementation?

I've been writing code in Python to prototype part of an application.
I've used the re regular expression pattern matcher. Now I have to take
what I've written and recode it in C to fit in an existing C app.

Anyway, is there a way to use the re regular expression evaluator in C?
Is it written in C?

Or does anyone know of a similar one that does search and match in
close to the same fashion with begin and end values returned?

Jan 6 '06 #1
3 1213
>>>>> techiepundit <te**********@futurepundit.com> writes:
I've been writing code in Python to prototype part of an application.
I've used the re regular expression pattern matcher. Now I have to take
what I've written and recode it in C to fit in an existing C app.


What platform? Linux includes a regex(7) implementation in the C
library. However, it doesn't support many of the extensions that Python
regexes support. Try http://www.pcre.org/. There are pre-build binaries for
Windows also.

Ganesan

--
Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA
Web: http://employees.org/~rganesan | http://rganesan.blogspot.com
Jan 6 '06 #2
Ganesan,

I'm trying to stay portable between Windows and Linux. My app will run
on Linux when deployed. But we do a lot of simulation on Windows
because of better dev tools available on Windows.

So I really want a regular expression implementation that'll compile
under MS VS 2003 C++ and also under Gnu C++ for Linux on both x86 and
ARM targets.

Jan 7 '06 #3
On 6 Jan 2006 11:24:14 -0800, te**********@futurepundit.com <te**********@futurepundit.com> wrote:
Ganesan,

I'm trying to stay portable between Windows and Linux. My app will run
on Linux when deployed. But we do a lot of simulation on Windows
because of better dev tools available on Windows.
(Lots of people seem to do so, and I can't understand why. I tend to
translate that to "we're not comfortable with working on our target
platform" ...)
So I really want a regular expression implementation that'll compile
under MS VS 2003 C++ and also under Gnu C++ for Linux on both x86 and
ARM targets.


Read the parent posting again. He recommended PCRE as the best compatible
solution. It would surprise me /a lot/ if that didn't compile on Windows.

/Jorgen

--
// Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
\X/ snipabacken.dyndns.org> R'lyeh wgah'nagl fhtagn!
Jan 8 '06 #4

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

Similar topics

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...
7
by: alphatan | last post by:
Is there relative source or document for this purpose? I've searched the index of "Mastering Regular Expression", but cannot get the useful information for C. Thanks in advanced. -- Learning...
3
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having...
2
by: Andrew Robert | last post by:
I have two Perl expressions If windows: perl -ple "s/()/sprintf(q#%%%2X#, ord $1)/ge" somefile.txt If posix perl -ple 's/()/sprintf("%%%2X", ord $1)/ge' somefile.txt
3
by: gisleyt | last post by:
I'm trying to compile a perfectly valid regex, but get the error message: r = re.compile(r'(*)(\d{1,3}\.\d{0,2})?(\d*)(\,\d{1,3}\.\d{0,2})?(\d*)?.*') Traceback (most recent call last): File...
15
by: Kay Schluehr | last post by:
I have a list of strings ls = and want to create a regular expression sx from it, such that sx.match(s) yields a SRE_Match object when s starts with an s_i for one i in . There might be...
8
by: Xah Lee | last post by:
the Python regex documentation is available at: http://xahlee.org/perl-python/python_re-write/lib/module-re.html Note that, i've just made the terms of use clear. Also, can anyone answer what...
10
by: igor.kulkin | last post by:
I have a small utility program written in Python which works pretty slow so I've decided to implement it in C. I did some benchmarking of Python's code performance. One of the parts of the program...
4
by: seberino | last post by:
I'm looking over the docs for the re module and can't find how to "NOT" an entire regex. For example..... How make regex that means "contains regex#1 but NOT regex#2" ? Chris
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.