Ir al contenido principal.
Enlaces relacionados:  Press Room  Company  Clients  Contact us
Solsoft

Forum

Re: how remove tags like "^a " ?


Author Message
Written on: 05. 05. 2003 [09:41]
fgomez@criba.edu.ar
=?Windows-1252?Q?Fernando_J._G=F3mez?
registered since: 31.12.1969
Posts: 0
From: "israel cefrin" <israel@fee.tche.br>
Sent: Monday, May 05, 2003 10:16 AM
Subject: how remove tags like "^a " ?


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> I am having a problem to remove subfield tags like "^a".
> On the php code i put
>
> $value = ereg_replace( "^a", "", $value );
> echo $value ;
>
> But it is not working, the "^" signal always remains, is this a problem
> with PHP ,openisis, my CDS/ISIS db ?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


The "problem" is with PHP's syntax for regular expressions. When you write

$value = ereg_replace( "^a", "", $value );

PHP expects to find a regular expression (a "pattern") as the 1st argument
to the ereg_replace function. And, in a regular expression, the "^"
character has a special meaning: it matches the beginning of a line. In this
case, you must use "\^", because the backslash is used to escape those
special meanings.

So try:

$value = ereg_replace( "\^a", "", $value );

And if you wanted to make all those subfield codes (^a, ^b, ^c, etc.)
dissapear at once, you could use something like:

$value = ereg_replace( "\^\w", "", $value );

(where "\w" matches any "word" character). For more precise information, see
the documentation on PHP's Regular Expressions.

Regards,

Fernando

======================================================Fernando J. Gómez

Biblioteca Dr. Antonio Monteiro
Instituto de Matemática de Bahía Blanca (CONICET/UNS)
Av. Alem 1253
8000 Bahía Blanca - Argentina
======================================================
------------------------------------------
Posted to Phorum via PhorumMail



User login

Enter your username and password here in order to log in on the website:
Login

Forgot your password?


Copyright © 2003-2009, Solsoft de Costa Rica S.A.
Declaración de privacidad