lets say i have these two patterns
patternWord=r'[a-zA-Z]+' #word patterns
patternNum=r'[+-]?\d+.?\d*' #numbers patterns

can i make a third pattern that is made out of them?
patternTrhee= NOT patternWord AND NOT patternNUM?

so than it will find all others?
didnt find how to combine patterns and my teacher doesn't know either O_O
thanks

I am not expert in using re in Python, but could this example I made be relevant?

import sys
import re

pattern = re.compile(r'\w+')

# process the text of this program as input
with open('./file.txt') as inp:
    text = inp.read()
    match = re.findall(pattern, text)
    not_match = re.split(pattern, text)

    print(match)
    print(not_match)

    numbers = [m for m in match if m.isdigit()]
    print(numbers)

    words = [m for m in match if  not m.isdigit()]
    print(words)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.