Help for this page

Select Code to Download


  1. or download this
    /(^.*\z)(?(?{ $+ eq reverse $+ })|(?!))/s
    
  2. or download this
    /
        (                            # capture group
    ...
    /xs                              # x for readability, s to make . matc
    +h \n
    
    # Note: can match empty string
    
  3. or download this
    rule palindrome {
        $foo := (\w+) ::: { fail if $foo ne reverse $foo }
    }
    
    # Note: doesn't match empty string
    
  4. or download this
    /(.+)(??{ reverse $+ })/s
    
  5. or download this
    /
        (.+)                          # match one or more characters
    ...
    /xs
    
    # Note: doesn't match empty string or single character string
    
  6. or download this
    rule palindrome {
        $foo := (\w+) <{ quotemeta reverse $foo }>
    }