* pcre module help
@ 2004-06-20 11:49 lists
2004-06-20 14:48 ` Clint Adams
0 siblings, 1 reply; 6+ messages in thread
From: lists @ 2004-06-20 11:49 UTC (permalink / raw)
To: zsh-users
Hi,
Can anyone provide an example for using the pcre module? I've looked
at the documentation and am unclear on what exactly pcre_compile,
pcre_study, and pcre_match do. Is in necessary to "compile" a pcre
before using it? Basically, I had intended on using the pcre module
like this:
if [[ $variable == pcre ]] ; then
blah
fi
Thanks,
Ryan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: pcre module help
2004-06-20 11:49 pcre module help lists
@ 2004-06-20 14:48 ` Clint Adams
2004-06-20 17:36 ` Vincent Stemen
0 siblings, 1 reply; 6+ messages in thread
From: Clint Adams @ 2004-06-20 14:48 UTC (permalink / raw)
To: zsh-users
> if [[ $variable == pcre ]] ; then
> blah
> fi
At this point, you have two options:
1)
pcre_compile pcre
if pcre_match $variable; then
blah
fi
2)
if [[ $variable -pcre-match pcre ]]; then
blah
fi
If these don't fit your needs, let us know.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: pcre module help
2004-06-20 14:48 ` Clint Adams
@ 2004-06-20 17:36 ` Vincent Stemen
2004-06-20 17:39 ` Vincent Stemen
2004-06-20 19:37 ` Clint Adams
0 siblings, 2 replies; 6+ messages in thread
From: Vincent Stemen @ 2004-06-20 17:36 UTC (permalink / raw)
To: zsh-users
On Sun, Jun 20, 2004 at 10:48:44AM -0400, Clint Adams wrote:
> > if [[ $variable == pcre ]] ; then
> > blah
> > fi
>
> At this point, you have two options:
>
> 1)
> pcre_compile pcre
> if pcre_match $variable; then
> blah
> fi
>
> 2)
> if [[ $variable -pcre-match pcre ]]; then
> blah
> fi
>
> If these don't fit your needs, let us know.
Hi.
I tried this under zsh-4.2.0 on FreeBSD with the zsh module statically
linked in.
Method 1)
# pcre_compile "^/.*local"
pcre_compile: not available on this system
# if pcre_match $PATH; then echo "matched"; fi
pcre_match: not available on this system
Method 2)
# if [[ $PATH -pcre-match '^/.*local' ]]; then echo "matched"; fi
zsh: unrecognized condition: `$PATH'
# pcre_compile "^/.*local"
pcre_compile: not available on this system
# if [[ $PATH -pcre-match '^/.*local' ]]; then echo "matched"; fi
-- shell crashes leaving a core file --
The shell crashing is consistent when I try to use -pcre-match after
attempting to run pcre_compile. Also, the -pcre-match method is not
mentioned in the zshmodules manual.
Regards,
Vincent
--
Vincent Stemen
Avoid the VeriSign/Network Solutions domain registration trap!
Read how Network Solutions (NSI) was involved in stealing our domain name.
http://www.InetAddresses.net
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: pcre module help
2004-06-20 17:36 ` Vincent Stemen
@ 2004-06-20 17:39 ` Vincent Stemen
2004-06-20 19:37 ` Clint Adams
1 sibling, 0 replies; 6+ messages in thread
From: Vincent Stemen @ 2004-06-20 17:39 UTC (permalink / raw)
To: zsh-users
On Sun, Jun 20, 2004 at 12:36:08PM -0500, Vincent Stemen wrote:
> I tried this under zsh-4.2.0 on FreeBSD with the zsh module statically
> linked in.
Sorry. I meant to say with the "pcre" modules statically linked in.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: pcre module help
2004-06-20 17:36 ` Vincent Stemen
2004-06-20 17:39 ` Vincent Stemen
@ 2004-06-20 19:37 ` Clint Adams
2004-06-20 21:20 ` Vincent Stemen
1 sibling, 1 reply; 6+ messages in thread
From: Clint Adams @ 2004-06-20 19:37 UTC (permalink / raw)
To: Vincent Stemen; +Cc: zsh-users
> I tried this under zsh-4.2.0 on FreeBSD with the zsh module statically
> linked in.
["pcre module" is meant]
Is the zsh binary actually linked against libpcre?
Does configure detect the existence of pcre_compile() and pcre_exec()?
You shouldn't get the "not available on this system" message unless it
didn't find one of them.
> pcre_compile: not available on this system
>
> pcre_match: not available on this system
>
> # if [[ $PATH -pcre-match '^/.*local' ]]; then echo "matched"; fi
>
> zsh: unrecognized condition: `$PATH'
>
> # pcre_compile "^/.*local"
>
> pcre_compile: not available on this system
>
> # if [[ $PATH -pcre-match '^/.*local' ]]; then echo "matched"; fi
>
> -- shell crashes leaving a core file --
>
> The shell crashing is consistent when I try to use -pcre-match after
> attempting to run pcre_compile. Also, the -pcre-match method is not
> mentioned in the zshmodules manual.
Could you send a gdb backtrace to zsh-workers?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: pcre module help
2004-06-20 19:37 ` Clint Adams
@ 2004-06-20 21:20 ` Vincent Stemen
0 siblings, 0 replies; 6+ messages in thread
From: Vincent Stemen @ 2004-06-20 21:20 UTC (permalink / raw)
To: zsh-users
On Sun, Jun 20, 2004 at 03:37:11PM -0400, Clint Adams wrote:
> > I tried this under zsh-4.2.0 on FreeBSD with the pcre module statically
> > linked in.
>
> Is the zsh binary actually linked against libpcre?
> Does configure detect the existence of pcre_compile() and pcre_exec()?
> You shouldn't get the "not available on this system" message unless it
> didn't find one of them.
Looks like you are right. I thought it would automatically use it if
it was available on the system and I enabled it in config.modules.
Especially since it still went through pcre detection, because I saw
output from configure that said,
checking pcre.h usability... yes
checking pcre.h presence... yes
checking for pcre.h... yes
However, further down I disovered it said,
checking for pcre_compile... no
checking for pcre_study... no
checking for pcre_exec... no
because it did not use -lpcre.
Enabling it with the configure option, --enable-pcre, seems to have
corrected that, although I have not recompiled and tested it yet.
> > pcre_compile: not available on this system
> >
> > pcre_match: not available on this system
>
> >
> > # if [[ $PATH -pcre-match '^/.*local' ]]; then echo "matched"; fi
> >
> > zsh: unrecognized condition: `$PATH'
> >
> > # pcre_compile "^/.*local"
> >
> > pcre_compile: not available on this system
> >
> > # if [[ $PATH -pcre-match '^/.*local' ]]; then echo "matched"; fi
> >
> > -- shell crashes leaving a core file --
> >
> > The shell crashing is consistent when I try to use -pcre-match after
> > attempting to run pcre_compile. Also, the -pcre-match method is not
> > mentioned in the zshmodules manual.
>
> Could you send a gdb backtrace to zsh-workers?
I would still think it should not crash because of a missing feature.
If you still would like a backtrace to find that problem, I will try
to get around to recompiling it with debugging turned on and generate
one for you. Just let me know.
Vincent
--
Vincent Stemen
Avoid the VeriSign/Network Solutions domain registration trap!
Read how Network Solutions (NSI) was involved in stealing our domain name.
http://www.InetAddresses.net
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-06-20 21:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-20 11:49 pcre module help lists
2004-06-20 14:48 ` Clint Adams
2004-06-20 17:36 ` Vincent Stemen
2004-06-20 17:39 ` Vincent Stemen
2004-06-20 19:37 ` Clint Adams
2004-06-20 21:20 ` Vincent Stemen
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).