RE: [OctDev] bug in regexp

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RE: [OctDev] bug in regexp

HALL, BENJAMIN            PW
There is an interface incompatibility between octave-forge regexp and
Matlab's regexp, most importantly, the order of the inputs

Octave:
[match s1 s2 ...] = regexp(pattern,string)

Matlab:
[START,FINISH,TOKENS] = REGEXP(STRING,EXPRESSION)

Also, I don't know if it is me, but I have never been able to get any of the
metasymbols to work:

pat = '(\d)+';  ## Octave complains about "\d", so
pat = '(\\d)+';

str = 'number of points is 475'

regexp(pat,str)

returns an empty matrix.

-----Original Message-----
From: Etienne Grossmann [mailto:[hidden email]]
Sent: Sunday, September 04, 2005 10:36 AM
To: [hidden email]; [hidden email];
[hidden email]
Cc: Stefan van der Walt; Octave Forge; [hidden email]
Subject: Re: [OctDev] bug in regexp



  Hi All,

I'm sorry for raising a false alarm, the problem I reported was due to
running an octave compile w/ one libc6 on a machine w/ another libc6
installed.

  Etienne

On Thu, Sep 01, 2005 at 08:40:14AM -0400, Etienne Grossmann wrote:
#
#   Hi All,
#
# thx for your replies. I use CVS octave-forge w/ octave 2.9.3 ... could
# it be a  library issue? It's libc6 2.3.5-3 (Debian) that provides
# regexp.h for regexp.cc.
#
#   Thx,
#
#   Etienne
#
# PS I'm terse to minimize typing to avoid arm pain.
#
# etienne@madrid: cvs update
# [hidden email]'s password:
# cvs update: Updating .
# etienne@madrid: make clean
# rm -f *.o core octave-core *.oct *~
# etienne@madrid: make
# mkoctfile -DHAVE_OCTAVE_29 -v regexp.cc
# g++ -c -fPIC -I/usr/local/include/octave-2.9.3
-I/usr/local/include/octave-2.9.3/octave -I/usr/local/include -mieee-fp -g
-O2 -DHAVE_OCTAVE_29 regexp.cc -o regexp.o
# g++ -shared -Wl,-Bsymbolic -o regexp.oct regexp.o
-L/usr/local/lib/octave-2.9.3 -loctinterp -loctave -lcruft -llapack -lcblas
-lf77blas -latlas -lfftw3 -lreadline -lncurses -ldl -lhdf5 -lz -lm
-L/usr/lib/gcc/i486-linux-gnu/3.4.5
-L/usr/lib/gcc/i486-linux-gnu/3.4.5/../../../../lib
-L/usr/lib/gcc/i486-linux-gnu/3.4.5/../../.. -L/lib/../lib -L/usr/lib/../lib
-lhdf5 -lz -lfrtbegin -lg2c -lm -lgcc_s
#
#
# On Thu, Sep 01, 2005 at 12:28:14PM +0200, Stefan van der Walt wrote:
# # Hi Etienne
# #
# # On Wed, Aug 31, 2005 at 06:41:33PM -0400, Etienne Grossmann wrote:
# # >
# # >   Hi All,
# # >
# # > I found this one, did not find any obvious cause and don't have time
# # > to look into it in depth.
# # >
# # > octave:1> regexp ("a","aaa")
# # > panic: Segmentation fault -- stopping myself...
# # > attempting to save variables to `octave-core'...
# # > save to `octave-core' complete
# #
# # I see
# #
# # octave:1> regexp("a", "aaa")
# # ans =
# #
# #   1  1
# #
# #
# # Do you have the latest Octave Forge version?  I am currently using the
# # Debian package from 2004/11/16.
# #
# # Regards
# # Stéfan
#
# --
# Etienne Grossmann ------ http://www.cs.uky.edu/~etienne

--
Etienne Grossmann ------ http://www.cs.uky.edu/~etienne


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Octave-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/octave-dev


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Octave-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/octave-dev
Reply | Threaded
Open this post in threaded view
|

Re: [OctDev] bug in regexp

Stéfan van der Walt
Regexp follows Paul Kienzle's convention, rather than MATLAB's.  I
think it was probably coded before MATLAB had regexp?  'pcregexp'
follows the same convention as 'regexp', so if you update the
interface, please look at both.

Regards
Stéfan

P.S. Metasymbols work with `pcregexp'

On Tue, Sep 06, 2005 at 08:33:53AM -0400, Hall, Benjamin wrote:

> There is an interface incompatibility between octave-forge regexp and
> Matlab's regexp, most importantly, the order of the inputs
>
> Octave:
> [match s1 s2 ...] = regexp(pattern,string)
>
> Matlab:
> [START,FINISH,TOKENS] = REGEXP(STRING,EXPRESSION)
>
> Also, I don't know if it is me, but I have never been able to get any of the
> metasymbols to work:
>
> pat = '(\d)+';  ## Octave complains about "\d", so
> pat = '(\\d)+';
>
> str = 'number of points is 475'
>
> regexp(pat,str)
>
> returns an empty matrix.


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Octave-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/octave-dev
Reply | Threaded
Open this post in threaded view
|

Re: [OctDev] bug in regexp

Paul Kienzle-3
Yes, I added regexp before it was available in matlab.  Please update
the interface to be compatible.

Please see the list for a discussion about escape characters in
strings.  My understanding is that recent versions of octave default to
string constants which do not process string escapes, and so should be
compatible with matlab.

Thanks,

        - Paul

On Sep 6, 2005, at 9:04 AM, Stefan van der Walt wrote:

> Regexp follows Paul Kienzle's convention, rather than MATLAB's.  I
> think it was probably coded before MATLAB had regexp?  'pcregexp'
> follows the same convention as 'regexp', so if you update the
> interface, please look at both.
>
> Regards
> Stéfan
>
> P.S. Metasymbols work with `pcregexp'
>
> On Tue, Sep 06, 2005 at 08:33:53AM -0400, Hall, Benjamin wrote:
>> There is an interface incompatibility between octave-forge regexp and
>> Matlab's regexp, most importantly, the order of the inputs
>>
>> Octave:
>> [match s1 s2 ...] = regexp(pattern,string)
>>
>> Matlab:
>> [START,FINISH,TOKENS] = REGEXP(STRING,EXPRESSION)
>>
>> Also, I don't know if it is me, but I have never been able to get any
>> of the
>> metasymbols to work:
>>
>> pat = '(\d)+';  ## Octave complains about "\d", so
>> pat = '(\\d)+';
>>
>> str = 'number of points is 475'
>>
>> regexp(pat,str)
>>
>> returns an empty matrix.
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing
> & QA
> Security * Process Improvement & Measurement *
> http://www.sqe.com/bsce5sf
> _______________________________________________
> Octave-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/octave-dev
>



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Octave-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/octave-dev