I have following regex in perl for replacing all continuous non-whitespace characters
perl -p -i.bak -e 's/^set gamma=\S*/set gamma=GAMMA/' tmp;
If the tmp
file contains set gamma=sdjfskdf; #comment
then I want to preserve the semicolon along with the comment. But using \S*
deletes sdjfskdf;
.
What change should I make to the regex?