1

I have the following formula:

 =REGEXEXTRACT(source!A2,"^[\w\s\À-ÿ]+")

where

 source!A2="Ancien Marché Saint-Jacques (1125, rue Ontario Est)" 

and I would like to extract

Ancien Marché Saint-Jacques

however I'm getting an error saying

Invalid escape sequence: \À

Any other idea on how to deal with the French characters?

1
  • 1
    Well, I got it to work changing my expression to: ^[\w\s\\À-ÿ-’']+ so double escaping seems to be required in this case
    – AlvaroFG
    Jul 28, 2013 at 2:09

3 Answers 3

1

Well, I got it to work changing my expression to:

^[\w\s\\À-ÿ-’']+ 

so double escaping seems to be required in this case

0

The square brackets, used in your regex example, indicate that you are searching for text within brackets. Losing the first straight bracket, wouldn't yield the expected outcome.

Therefore, if this is the way all data is being presented,

Description of Object (postal code, street),

then this will be of use as well:

=INDEX(SPLIT(source, "("),1,1)

The SPLIT() function will split the result, where the first ( occurs. The INDEX() function will only show the first row (1) on the first column (1).

1
  • Hi @Jacob, great suggestion (i guess once one learn how to use a hammer (regex) everything looks like nails). Unfortunately, for me, while all the information is withing brackets, not all of them is the expected address. Example: Cathédrale Saint-Jacques-le-Majeur (aujourd'hui cathédrale Maie-Reine-du-Monde - boulevard Dorchester Ouest, aujourd'hui boulevard René-Lévesque Ouest) (here I don't expect anything in return, it is just too complex) Bibliothèque Saint-Sulpice (devenue Bibliothèque nationale du Québec- 1700, rue Saint-Denis) Here I'm getting 1700, rue Saint-Denis, which is ok
    – AlvaroFG
    Aug 7, 2013 at 20:02
0

Another option is to Find ((.+)\s\(.+)/Replace($1) on a copy:

WA47188 example

Always best to avoid dealings with French characters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.