2

Having read the answer in the Remove all punctuation except apostrophes in R post, I tried to use

'[[:space:]]|[^\/[:^punct:]]'

in REGEXP_REPLACE function, but it gives me

[2201B] ERROR: invalid regular expression: invalid character class

How can I make it work?

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Med Amine
  • 23
  • 3

1 Answers1

1

The question you link to is tagged with , where stringr library uses ICU regex flavor that supports POSIX character classes in its own way, not necessarily POSIX compatible.

To match any whitespace or any punctuation but / you may use

[^/[:alnum:]]

It matches any char that is not alphanumeric (and that means it is either a whitespace or punctuation) and not a / char.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563