in reply to split with separators but dont include in the array
We start with:
@arr = split /(?=(&&|\|\|))/, $str; # @arr = ('<chap', '&&', '&&<book', '||', '||<table', '&&', '&&<list') +;
Use non-capturing (?:...) instead of the capturing (...):
@arr = split /(?=(?:&&|\|\|))/, $str; # @arr = ('<chap', '&&<book', '||<table', '&&<list');
But neither are needed here
@arr = split /(?=&&|\|\|)/, $str; # @arr = ('<chap', '&&<book', '||<table', '&&<list');
Are you sure you want to use (?=...)?
@arr = split /&&|\|\|/, $str; # @arr = ('<chap', '<book', '<table', '<list');
|
|---|