Ir al contenido principal.
Enlaces relacionados:  Prensa  Compañía  Clientes  Contáctenos


Re: how remove tags like "^a " ?

Autor Mensaje
Escrito en: 05. 05. 2003 [09:41]
registrado desde: 31.12.1969
Entradas: 0
From: "israel cefrin" <>
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.



======================================================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

Iniciar sesión de usuario

Introduzca su nombre de usuario y contraseña para iniciar su sesión en el sitio web:
Iniciar sesión

¿Ha olvidado su contraseña?

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