Tag Archives: regular expressions
Perl – Using Pattern-sequence Memory with Regular Expressions
Pattern-sequence memory is very useful when you want to match the same character in several places but don’t care which character you match as long as all occurrences are the same character. For example, the below code matches the date … Continue reading
Posted in Perl, Programming Languages, Technology
Tagged pattern memory, pattern-sequence, pattern-sequence memory, Pattern-sequence Memory with Regular Expressions, perl, perl regular expressions, regex, regular expressions, sequence memory, Using Pattern-sequence Memory with Regular Expressions
Leave a comment
Use Perl’s regex to count the # of words in a file
In the below code I use Perl’s regex capabilites to count the # of words in a file. Notice I used “\s” in the regex expression to account for not only spaces but also tab and new line characters. In … Continue reading
Posted in Perl, Programming Languages
Tagged count words, file word count, file word counter, open file, perl, perl close file, perl code, perl file input, perl open file, perl read file, perl regex, perl regular expressions, perl word count code, regex, regex expression, regular expressions, whitespace, word counter
Leave a comment