Domanda

I'm looking for a pattern that will match anything but this:

"/[a-z0-9]/i"

How can i do that?

È stato utile?

Soluzione

With ^, which negates a character set.

You want /[^a-z0-9]/i.

[a-z] matches a..z. [^a-z] matches anything not a..z.

Altri suggerimenti

/[^a-z0-9]/i

The ^ at the start inside a [ ] means "none of these" rather than the conventional "any of these"

If he wants something matches not a-z0-9 one time, this is it. this matches spaces, everything that isn't a-z0-9, one time

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top