in reply to Re: Re: Upper case first letter of each _ delimited word
in thread Upper case first letter of each _ delimited word
To match an entire word, from one delimiter to the next, I used a non-greedy match and a positive lookahead.sub ucwords { my($new, $delim) = @_; $new =~ s/($delim|^)(.*?)(?=$delim|$)/$1\u\L$2/sg; $new; }
|
|---|