C:\@Work\Perl>perl -wMstrict -e "print qq(\no/p: \n); for (@ARGV) { print qq(\"$_\" \n); s{ ( (?: \A | [.!?]) \s*)? ([a-zA-Z]) } { ($1 || '') . (defined $1 ? uc $2 : lc $2) }egxms; print qq('$_' \n\n) }" "today is wednesday.tomorrow IS THURSDAY." " is tODAY wednesday? yes, but yesterDAY was tuesday! i See. " "i thought today was... never mind." "what a day!" o/p: "today is wednesday.tomorrow IS THURSDAY." 'Today is wednesday.Tomorrow is thursday.' " is tODAY wednesday? yes, but yesterDAY was tuesday! i See. " ' Is today wednesday? Yes, but yesterday was tuesday! I see. ' "i thought today was... never mind." 'I thought today was... Never mind.' "what a day!" 'What a day!'
In reply to Re: regex for text manipulation
by Anonymous Monk
in thread regex for text manipulation
by megaurav2002
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |