Code:
alias hehtest { 
  var %r = /^[0-9]{1,3}(?:\.\d{1,3}){3}$/
  var %t = 17.17.17.17
  ; Using variables, the first test functions as expected, echoing a 1.
  echo -a First test: $regex(%t,%r)

  ; No variable useage, the exact same plain text as the variables, but fails
  ; and echos a 0.  
  ; Also, you can not specify a <name> parameter when you do this..
  echo -a Second test: $regex(17.17.17.17,/^[0-9]{1,3}(?:\.\d{1,3}){3}$/)

  ; Almost the split image of above, but we encompas it in (),
  ; and doing so will echo a 1.
  echo -a Third test: $regex(17.17.17.17,/^([0-9]{1,3}(?:\.\d{1,3}){3})$/)

  ; Now, just going off of assumptions here. I'm assuming it's the "," in {1,3}
  ; That is causing it to not work. As this fails the test too:
  echo -a Alternative: $regex(17.17.17.17,/^[0-9.]{1,}$/)

  ; And this one passes:
  echo -a Next Alternative: $regex(17.17.17.17,/^[0-9.]{11}$/)
}


My guess is that the "," (ie: {1,}) is breaking the function unless you enclose it in (). When you do use the {1,} it also makes it so you can no longer use the optional name parameter in the $regex()

Edit: Yeah, I'm assuming this might be a known bug/problem, but I've got a cold and I'm tired, so didn't bother to search before I posted. So no need to point that out to me.

Last edited by Rand; 24/08/07 05:09 AM.