Im trying to get this Ruby code beautifier working and have hit on a problem to do with regular expressions that to be honest I just don’t understand as my experience with them is extremely limited.
The error that Im getting is:
warning: character class has duplicated range: /.*=\s*<<-?\s*([_|\w]+).*/
Which points to this line:
here_doc_term = tline.sub(%r{.*=\s*<<-?\s*([_|\w]+).*},"\\1")
Could someone please be kind enough to point out what the issue is with this expression?
Thanks.
Basically this warning, tells you that a character class that you’re using has some redundant pattern. I assume it points to the
[_|\w], as\walready contains underscores.This discussion might help understanding it more.