From: Todd R Johnson on 23 Jul 2010 07:14 I am writing a simple application where I'd like the user to be able to inp= ut a regular expression that will be used to filter data. I'd like the Inpu= tField to accept the string without requiring double quotes. The following = code works, but requires the quotes: Manipulate[ StringMatchQ[ "take the money and run", ___ ~~ RegularExpression[ s] ~~ ___], {{s, "take|run" , "regex"}, ControlType -> InputField[, String]}] The following using ToString doesn't work because the input is treated as a= n expression and then converted to a string containing spaces before and af= ter the |, so typing run|take in the input field results in the string "run= | take". Manipulate[ StringMatchQ[ "take the money and run", ___ ~~ RegularExpression[ ToString[s]] ~~ ___], {{s, , "regex"}, ControlType -> InputField[, String]}] Is there any way to tell Manipulate to accept the exact string that the use= r types? Todd R. Johnson, Phd Associate Professor The University of Texas School of Biomedical Informatics at Houston 7000 Fannin Suite 600 Houston, TX 77030 Voice: 713-500-3921 Fax: 713-500-3929
|
Pages: 1 Prev: A question on plot3D Next: FDTD Code or Example? (2D wave eqn, rect grid, coords x,y,t) |