Accepting string input with quotes in Manipulate
- To: mathgroup at smc.vnet.net
- Subject: [mg111211] Accepting string input with quotes in Manipulate
- From: Todd R Johnson <Todd.R.Johnson at uth.tmc.edu>
- Date: Fri, 23 Jul 2010 07:15:00 -0400 (EDT)
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