Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Count the number of occurrences of a specific character in a string

oracleoftemple
9 - Comet

All I'm trying to do it count the number of times a specific character (a pipe) occurs in a string.  Can someone help me with this?

3 REPLIES 3
binuacs
20 - Arcturus

@oracleoftemple One way of doing this with the REGEX_CountMatches function

REGEX_CountMatches([Text], '\|')

 

binuacs_0-1680100065189.png

 

ShankerV
17 - Castor

Hi @oracleoftemple 

 

One way of doing this.

 

REGEX_CountMatches([Field1],'\|')

 

ShankerV_0-1680100223066.png

 

 

Many thanks

Shanker V

newtum
5 - Atom

Here I have written a Python program to count the number of occurrences of a specific character in a string -https://blog.newtum.com/count-the-number-of-occurrences-of-a-character-in-a-string-in-python/

Labels