ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

regexp_count() Not Matching All [:punct:] Characters

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • regexp_count() Not Matching All [:punct:] Characters

    It was my understanding that specifying [[unct:]] as a regexp would find all special characters: ! ' # S % & ' ( ) * + , - . / : ; < = > ? @ [ / ] ^ _ { | } ~

    However, when I run this code, it shows it's not a match:

    PHP Code:
    with tmp as (
    select 
        
    '~' as string
    from sysibm
    .sysdummy1
    )
    select
        tmp
    .string
        
    regexp_count(tmp.string,'[[:punct:]]') as punctmatchcount
        
    regexp_count(tmp.string,'[^[:punct:]]') as punctunmatchcount

    from tmp

    Am I missing something?

  • #2
    Here is a list of the characters that do qualify as punct: !@#%&*()_-{}[]\:;,.?/

    Comment

    Working...
    X