Please take questions about Python coding

Asked 2 years ago, Updated 2 years ago, 17 views

It's a question when you use Python regular expression re.compile [email protected] Hong Gil-dong  If you only want to print out the previous email address here, in the regular expression, This is re.compile (₩bww+@[ww.]+₩bb It can be expressed like this I don't understand what's in thereㅠ<

4. How can you tell when it is used as a regular expression and when it is just a text? The snail up there is just a textㅠ<

I also have other questionscrying The problem is re.search('D*[abc][abc]','₩tabc[abc]1234₩t₩n').group() The answer is It's called Tabc[abc.

D*[abc][abc]','₩tabc[abc]1234₩t₩n').group()

1. First of all, the interpretation of that regular expression You start by repeating 0 or more letters, not numbers Is it one of abc and one of a.b.c?

If I'm right about the interpretation above, If you start with 0 or more letters than a number, t tabc[abc] Shouldn't this all be the answer? There's 1234 on the back of what I wrote That's not a numberI don't understand

And there's one out of a, b, and c, and then there's another Since it is one of a, b, and c, no matter how many times you match it, is it right that it is only two letters?  Help me

python

2022-09-22 19:16

1 Answers

re.compile('\\b\w+@[\w.]+\\b')

There is a lot of misunderstanding

re.compile(r'\b\w+@[\w.]+\b')

Use raw string.

re.compile('\\b\\w+@[\\w.]+\\b')

I think it would be better to express all '\' as '\'.

1) [\w.]+ is word(a,b,c...) _ etc.) I mean a series of letters. ('.') With just this [anonymous, daum.net] or something like that...

2) means [in Chinese characters] because it is inside.

3), 4) I don't know what the question is... @ is just a Chinese character.

The next question is, rather than asking every time, I think it would be better to practice at https://regexr.com/...

Anyway [abc][abc] means aa, ab, ac, ba, bb, bc, ca, cb, cc.

Up to t tabc[a] matches /D* (non-numeric characters), and bc matches [abc][abc].


2022-09-22 19:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.