<commit_before>* 




#+BEGIN_SRC groovy

Pattern myRegex = ~/regex/



Matcher myMatcher = 'subject' =~ /regex/




#+END_SRC
<commit_msg>updated the groovy repl options<commit_after>* 

 There are five kinds of strings in groovy


#+BEGIN_SRC groovy

Pattern myRegex = ~/regex/



Matcher myMatcher = 'subject' =~ /regex/

Matcher myMatcher = Pattern.compile(/regex/).matcher("subject")



#+END_SRC


** \b is word boundary

#+BEGIN_SRC groovy

def shoutedWord = ~/\b[A-Z]+\b/

def matcher = ("EUREKA" =~ shoutedWord)

assert matcher.matches()

def numberMatches = "1234" =~ /\d+/

assert numberMatches.matches()

#+END_SRC



** This is another useful operator 
   ==~
 #+BEGIN_SRC groovy

assert "1234" ==~ /\d+/

assert "FOO" ==~ /\d+/
 
 #+END_SRC


* 
#+BEGIN_SRC bash

cat text.txt| groovyclient -np -e "line.replaceAll("\a","\A")"

gvcl -pi -e 'line.replaceAll("A","a")' 4.txt

#+END_SRC


* COUNT and LINE variables are available for `groovy -e ` script options

{'fraction_non_alphanumeric': 0.15724563206577596, 'fraction_numerical': 0.009249743062692703, 'mean_word_length': 3.530232558139535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5475726', 'n_tokens_mistral': 411, 'n_tokens_neox': 357, 'n_words': 98}