Conscious commented on a Page, Random Quote/Fact  -  Mar 19, 2011

Example of confilcting Regular Expressions with aliases:

alias regextest {
  noop $regex(Here is my regex,/(.+)/)
  echo -a $!regml(1): $regml(1)
  var %a = $regedit($regml(1))
  var %b = $regml(1)
  echo -a % $+ a - %a
  echo -a % $+ b - %b
}
alias regedit return $regsubex(abc,/D/,lol)

that kills the original $regml(1), and replaces it with nothing, as there is no $regml to be captured in that alias.

However; adding a regex name to the identifier solves this problem.

alias regextest2 {
  noop $regex(Here is my regex,/(.+)/)
  echo -a $!regml(1): $regml(1)
  var %a = $regedit2($regml(1))
  var %b = $regml(1)
  echo -a % $+ a - %a
  echo -a % $+ b - %b
}
alias regedit2 return $regsubex($ticks,abc,/D/,lol)
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.