Monday, October 24, 2011

"Prepend" doesn't mean what you think it means

For years, I thought prepend text meant something similar to append text, accept it meant to add text to the beginning instead of the end of a word. Turns out that even though lots of other people seem to think the same thing, it actually means something else:
"Prepend" is a very obscure word which means literally to premeditate, as in, "He looked at her with malice prepended."
Source: http://cygwin.com/ml/cygwin/2001-07/msg01544.html Now I'm going to have to retrain my brain to start using another word. I'm not even sure what word works best here. Prefix text?

Thursday, February 17, 2011

Finally got a regular expression to validate a number between zero and eleven, allowing a leading zero. It allows only two digits to be entered maximum, and you can put one whitespace character before or after a single digit. Tested in Firefox 3.6 and IE 6.

It should be simple, but "simple" wasn't working in Firefox 3.6. I didn't bother testing other browsers with the one that didn't work in Firefox.

<asp:RegularExpressionValidator ControlToValidate="txtNumberOfMonths"
ErrorMessage="Months At: Please use a rounded number from 0 to 11"
ValidationExpression="^[\s]*((0?[0-9])|(1[0-1]))[\s]*$" runat="server"/>

The simple regex that didn't work was: "\s*(0?\d|1[01])\s*