s-news
[Top] [All Lists]

Searching special characters in vector of strings.

To: s-news@wubios.wustl.edu
Subject: Searching special characters in vector of strings.
From: gerald.jean@dgag.ca
Date: Tue, 22 Aug 2006 11:14:48 -0400
Hello everyone,

how can I search for a string like

" 2+ sin en 3 ans"

in a vector of character strings as:

[1] "nbsinst 0  sin en 3 ansnewzv Eleve" "nbsinst 1  sin en 3 ansnewzv
Eleve"
[3] "nbsinst 2+ sin en 3 ansnewzv Eleve" "nbsinst 0  sin en 3 ansnewzv
Basse"
[5] "nbsinst 1  sin en 3 ansnewzv Basse" "nbsinst 2+ sin en 3 ansnewzv
Basse"
[7] "nbsinst 0  sin en 3 ansnewzv Moyen" "nbsinst 1  sin en 3 ansnewzv
Moyen"
[9] "nbsinst 2+ sin en 3 ansnewzv Moyen"

I know that I could use something like "\+" in regexpr but I would like to
be able to do the search generally using the same code for searching, for
example, for

" 1  sin en 3 ans"

in the same vector. The search is part of a function and the function is
used extensively and, unfortunately, it bums when there is special
characters in the pattern to search for and / or in the vector of strings
to search in.

Thanks,

Gérald Jean
Conseiller senior en statistiques, Actuariat
télephone            : (418) 835-4900 poste (7639)
télecopieur          : (418) 835-6657
courrier électronique: gerald.jean@dgag.ca

"In God we trust, all others must bring data"  W. Edwards Deming

Le message ci-dessus, ainsi que les documents l'accompagnant, sont destinés 
uniquement aux personnes identifiées et peuvent contenir des informations
privilégiées, confidentielles ou ne pouvant être divulguées. Si vous avez reçu 
ce message par erreur, veuillez le détruire.

This communication (and/or the attachments) is intended for named recipients 
only and may contain privileged or confidential information which is not
to be disclosed. If you received this communication by mistake please destroy 
all copies.



<Prev in Thread] Current Thread [Next in Thread>