Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

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
21 - Polaris

@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