« first day (1245 days earlier)      last day (2111 days later) » 

1:50 PM
Why print(re.search(r'\W*', 'hell0_there')) # It gives '' doesn't give None instead it gives (0,0)?
there is no match...
 
"*" means "0 or more of the preceding pattern". It is succesfully matching zero instances of "\W". In other words, the empty string.
If you don't want to match 0 instances, use "+" instead
 
 
1 hour later…
2:56 PM
Any line that starts with # should return None
print(re.search(r'^#[^\w\.\s]', '# 1.3.6.4.1.2.1 0x443323f 1.3.4.1.2.1717(0,1)'))
Can this regex pattern be more simpler? ^#[^\w\.\s]
 
if line.startswith("#"): continue
Then you don't need to write a regex for it at all :-)
 
ok
startswith() would just read the first character and then return boolean...
 
3:16 PM
print(re.search(r'\b\S+\b', '\t hell0_there(0,1) \t'))      #  'hell0_there(0,1'
print(re.search(r'\b\S+\b','\t  1.3.6.1.4.1.9148.3.2.2.3(1,0)  \t')) # Missing closed paran
to detect word boundaries..
split() works
 
@overexchange as you know we usually find your inquiries here confusing and tiresome. You're doing the same thing again. You didn't even ask a question this last time, and you're using us as a substitute for a regex tutorial. Please stop.
 
Thank you.
 
 
1 hour later…
4:45 PM
18 messages moved from Python
 
5:19 PM
my favorite people on SO are the high-rep people who just cruise around half-reading questions and downvoting/leaving completely uninformed critical comments
i can't imagine living a life in which i spent a large part of every day doing that . . . what a weird little segment of modern humanity
@Kevin lol . . . i think there's something positive about spending a lot of time on SO helping people . . . i just don't get why you'd ever feel the need to try to sabotage some random person trying to get help merely because you don't like the way they worded their question or whatever
just let it be . . .
 
Because questions and answers are curated so that people who look at them in the future might also be helped by them... if someone posts a question that is unhelpful to anyone except them, it lowers the overall helpfulness density
 
you're assuming the questions are actually low quality . . . you're assuming you are able to take a glance and something and accurately judge it . . . which is a false assumption about 1/3 of the time, i'd argue
*glance at
 
Not interested in rehashing this for the Nth time.
8 messages moved from Python
 

« first day (1245 days earlier)      last day (2111 days later) »