Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
regular expression reverse match?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Ron Adam, post: 1734516"] I already know the search string... Or will once I understand the how to form them to do what I want. <hopefully> What I don't know is the completed string that will match to it beforehand. Or at least that's the idea. I'm writing an interactive keyboard input routine and want to use re to specify the allowed input. Some things are easy like only allowing digits or characters. So far I can check for %i and %f first to specify simple ints and floats. A test cast operation with an exception handles those perfectly. As it is, the program checks the input buffer after each keystroke and determines if the buffer is acceptable against a pattern as the string is being built. A reverse match. It allows new keystrokes to be added to the buffer as long as it's within the pattern. I was hoping to use regular expression patterns as a function argument to specify a wide range of input patterns. I'm still a little new to Python and a lot new to the regular expressions although I've used variations of them before. So how do I say.... accept only 1 character out of set [YyNn] but only one character and do not match Ye, yy nn etc... .... accept only 10 of any type characters but not 11 .... accept only the letters of "a particular string" sequentially and then no more. .... accept a number in the form of "nnn-nnn-nnn" sequentially with required dashes. ..... accept any sequence of characters and numbers as long as they contain at least 1 of each type, cap letter, small letter, and digit and be a minimum of 6 characters long. ie.... a password check. It's probably easy to do all of these given a completed string first. This started out as a python learning project.. <grin> but it's sort turned into a real interesting coding situation. Thanks for the reply. _Ron Adam I'll give it a try... not sure either. Like I said, this is kind of new to me. :) [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
regular expression reverse match?
Top