#!/usr/bin/perl -l # http://perlmonks.org/?node_id=1206677 use strict; use warnings; for ( 'Thanos1983+|Thanos1983', 'Thanos1983+|' ) { print; /([^|]*)(\|)([^|]*)/ and print "I found:\t\$1: '$1'\t\$2: '$2'\t\$3: + '$3'"; }
Outputs:
Thanos1983+|Thanos1983 I found: $1: 'Thanos1983+' $2: '|' $3: 'Thanos1983' Thanos1983+| I found: $1: 'Thanos1983+' $2: '|' $3: ''
In reply to Re: Split string in groups with non white space using regex
by tybalt89
in thread Split string in groups with non white space using regex
by thanos1983
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |