I'm using the re module to validate IP address, this is my pattern:
"^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$"
Is there a way to know if a string can become a potential match without chaniging the pattern? for example: "127.0.0." is good or "10.0" however "10.." is not good. I don't mean the re.match function, I want to know if a string is not a match but it could be.
I need a function that will do something like this:
import re
p = re.potential("10.0","^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$")
print p # True
Edit: the thing is I want to know if I can recognize a potential match and use it to limit the wx.TextCtrl with the wx.EVT_CHAR Event, I didn't ask about my pattern. right now I have implemented it like this:
def OnChar(self,event):
    """event validation of ip"""
    key = event.GetKeyCode()
    text_value = event.GetEventObject().GetValue()
    length = len(text_value)
    numbers = True
    point = True
    if length:
        if length>2 and '.' not in text_value[-1:-4:-1]:
            numbers = False
        elif text_value[-1] =='.':
            point=False
    if Keys.is_numeric(key) and numbers:
        event.Skip()
    if Keys.equal(key,'.') and point:
        event.Skip()
    if Keys.is_moves(key):
        event.Skip()
This way the text the user enters can't be something not good, but is there a way to do it with the re module?