I've always found regexes a bit confusing and just tend to look them up when I need to. Appreciate the patience with which you do these problems. It helps so much in building understanding of approach to solution unlike some channels which just walkthough algos. We need to build problem solving skills and not memorization. Content quality and teaching style is awesome.
tomorrow is my code-nation interview, kaash yahi puchle voh . You are amazing man, learnt a lot of things as it was the first time doing regex. Best coding channel ever found
Correction: It seems like you may be looking for a pattern that specifically matches the sequence ab repeated one or more times. If that's the case, you should use the regular expression (ab)+ , not [ab]+. The regular expression [ab]+ will match any string that contains one or more occurrences of either a or b. The + sign specifies one or more occurrences, and the [ab] specifies a character class, which matches any character that is either a or b.
I'm amazed at the way you taught this. You started with a simple regex to eventually build the logic for the main problem. Kudos and thank you for this explanation. I felt sorry for you at the end when you had to rush as it seemed you were worried about video length. But let me tell you a good student/follower wouldn't mind lengthy but useful explanation. Thank you once again.
Awesome. Initially I have solved it with the straightforward approach using conditional operators and string operators. But solving it with regex was more reliable and efficient. Thanks for your efforts.
i didn't know giving spaces betweeen OR operator ( | ) will not throw an error but will always return "Neither" as the answer. Thanks for explaining regex. TBH i heard it for the first time.
@@techdose4u Don't worry the subscriber count will increase fast. You need to just make more videos of codeforces/CodeChef contests also because many people take that contest.
I think yours is the only channel which explained in regex bro Regex takes very less time If I am not wrong in this code it is O(1) as there are greedy quantifiers here Please correct me if I am wrong
Time complexity won't be O(1) because expression matching parses the string. I don't use regex as don't face problems where I should use it but you can go through the regex on official website and get the internal working of this. Then everything will be clear.
bro thank u for giving details knowledge of regex function,but i have bit doubt that after making three digit i.e1(0-9)(0-9) cann't we make a range directly from 200 to 255?here u are spliting it i.e from 200 to 249 and then 249 to 255
bro we need to split 200-255 into 200-249 and 250-255 because if you write 2[0-5][0-5] instead of splitting then your regex will fail for integers like 219,238 etc as highest limit is till 5 only ...i hope you got my point.
Sir my one doubt is that sir you do not consider 000.038.098.098 (MEANS ZERO ) is not consider to be an ip address but on hackerrank they have consider a zero (000.12.12.034) is an ip . So sir our coding consider to be this will be wrong ? Sir please tell related to this problem coding also
loved the explanation sir , sir i am not able to implemment it in my python code the same regex pattern over there is giving me differnt result, i want to extract IP adresses from a log file Thanks Sir
Goog work! Nice explanation. But, about IPv6, do you really need to escape colon (:)? ([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4}) But your solution will be accepted, because, there is no special characters in the input string Any way, great job!
Good explanation. My only feedback, regex are a higher level. Internally they parse the string and use recursivity. I saw most answers on leetcode parse the string and none used regex.
10:53 Repeat Expression - explanation and examples are wrong. Eg. [1-9][0-9]{2} - This will not validate 4 digit number. It'll validate 3 digits numbers only. Also 2[0-4][0-9]{2} will not validate 6 digit number; only 4 digit numbers are validated.
U decided to teach the whole logic and solved the purpose of this question. Brilliant explanation
Q😅
I've always found regexes a bit confusing and just tend to look them up when I need to. Appreciate the patience with which you do these problems. It helps so much in building understanding of approach to solution unlike some channels which just walkthough algos. We need to build problem solving skills and not memorization. Content quality and teaching style is awesome.
Thanks :)
this is the first, last and best video I have ever seen on Regex
Last! 🤭
tomorrow is my code-nation interview, kaash yahi puchle voh . You are amazing man, learnt a lot of things as it was the first time doing regex. Best coding channel ever found
Thanks :) good luck
Bhaiya from future, kya hua interview ka?
I think this crash course on regex is concisely packed with good content.
Big thanks to author!
Welcome :)
Correction:
It seems like you may be looking for a pattern that specifically matches the sequence ab repeated one or more times. If that's the case, you should use the regular expression (ab)+ , not [ab]+.
The regular expression [ab]+ will match any string that contains one or more occurrences of either a or b. The + sign specifies one or more occurrences, and the [ab] specifies a character class, which matches any character that is either a or b.
Exactly, I was thinking the same. Thanks for this correction.
Loved this explanation. This is the first time ever that I have understood regex and that too so well. Thanks a lot.
Welcome :)
A big fan of the way of explaining your videos, sir. Understood it very well. Thank you for making us not hate coding.
Not hate coding! 😅 Welcome 😀
I'm amazed at the way you taught this. You started with a simple regex to eventually build the logic for the main problem.
Kudos and thank you for this explanation.
I felt sorry for you at the end when you had to rush as it seemed you were worried about video length. But let me tell you a good student/follower wouldn't mind lengthy but useful explanation.
Thank you once again.
😅 welcome
this is the most clear explanation of regex formation for validation.
Awesome. Initially I have solved it with the straightforward approach using conditional operators and string operators. But solving it with regex was more reliable and efficient. Thanks for your efforts.
Welcome :)
Brilliant , I learnt Regx in one video + solved a leetcode question , Thanks a lot sir
I always search your channel for any complex problem explanation and u never disappoint me with ur excellent explanation approach.thanks😀
Best Regex Video ever made. Thank You.
Welcome :)
The best REGEX Explanation Ever....!!!! Great Teaching Skills..... :)
Thanks :)
i like your teaching. The way you cleared the suspensive doubt. I really appreciate your work.
Thanks
OMG! Your explanation is AMAZING! It is clear and very easy to understand. Thank you, Sir!
Welcome
Regex library for validating an IP is totally explained.
Excellent explanation dude;!
Thanks :)
was looking all around for some explanation on regex syntax. thanks man.
Welcome :)
Thnkyou, I could find regex pattern but not explanation anywhere. Now its registered in my mind.
U r awesome in regular expression . It cleared my all doubt of regular expression
👍
Best and fruitful video for regex
Thanks :)
I kept this video in my favorite list
and thanks for the excellent explanation
Welcome :)
I understood sir , simple explanation,thnx for this
Thankyou brother, you explaining me about REGEX
Thanks for such a detailed explanation. I was searching for some explanation like this. Awesome presentation. Keep it up....
Thanks
Just Amazing.....just Amazing...
Thanks
Nice Explanation
Thanks
Love you brother................a lot of thanks
Welcome
superb explanation. Thank you
Welcome :)
i didn't know giving spaces betweeen OR operator ( | ) will not throw an error but will always return "Neither" as the answer.
Thanks for explaining regex. TBH i heard it for the first time.
Learner something new :)
@@techdose4u bro can you please solve the last year codevita' s atm problem. Any help would be grateful.
Really it is helpful to me while learn first time about the concept...hats off
Thanks
Excellent explanation on question and on regex
Thanks
you are just amazing....thank you so much
best explanation. mainly regex part. thanks
Welcome :)
Wow! That was a fantastic concept
Thanks :)
Thank you 😊 so much sir .. This video is really Very helpful to identify validation of ip address 😊☺️
Welcome :)
Best explanation, thanks for the Video ❣️
Thanks for regex concepts....
Welcome :)
super se bhi upper explanation
Thanks :)
I think I found +1 great channel ✨
So good. Excellent!
absolutely brilliant ❤️ terrific explanation 🔥🔥
very well explained. now i know regex also :-)
What program are you using to do that presentation?
It is really cool!!!!
Thanks for the video!
Bro boht boht sukriya iski kafi zarurat thi
👍
I am sure I will not forget Regex anymore:)
😀
thank you for the clear and detailed explanation!
Loved the video!Sir can u please guide us how are you so consistent in ur work,It would really help us all!
Because I love to do it. That's all.
Simply Amazing !!! Thanks !!
really gud question and great explanation
Thanks :)
Amazing explanation....
Thanks :)
Great explanation 😀 thanks
Welcome
Why subscriber count of this channel is so less.. 😧😧 It is one of best channel available on ytb
😅
@@techdose4u Don't worry the subscriber count will increase fast. You need to just make more videos of codeforces/CodeChef contests also because many people take that contest.
Thankyou soo much sir ,so easy and Great explanation.
Good Explanation in Planet
Thanks :)
Once again proved...u r ultra legend bro
😅
Excellent explain
Thanks
Simple and Clean👍👍
Thanks :)
Thank you very much 🙏
It worked, really thanks :)
Welcome :)
you should write a book😍😍😍
unmatchable content👍
🤓
Keep updating u make things soo easy
:)
Amazing Work!
Thanks
Boooooooooooooooom Big thanks🥰🥰🥰🥰🥰
Welcome 😄
thank you so much!
you are doing a lot of good things bro. proud of you. thank you.
Welcome:)
perfect explanation
Thanks :)
[1-9][0-9]{2}-----> for all three digit numbers, not for four digit numbers at 12:02
Yea right :)
For [1-9][0-9]{2}
You mean by "three digits" it will repeat only for the bracket [0-9] and not the [1-9] ??
can we add "." at the end of string so that it could handle last expression also?
🔥🔥🔥💥🤘🤘 awesome video
Thanks bro :)
Till now I don't aware of this method thanks for explaining new topic which is ignored normally
I think yours is the only channel which explained in regex bro
Regex takes very less time
If I am not wrong in this code it is O(1) as there are greedy quantifiers here
Please correct me if I am wrong
Time complexity won't be O(1) because expression matching parses the string. I don't use regex as don't face problems where I should use it but you can go through the regex on official website and get the internal working of this. Then everything will be clear.
If the regex is [ab-ca] , in that case will all of ab, bc,ca be valid or not ?
what about when we encounter a :: case in ipv6 address?,how is that handled?
Every colon is preceded by 1 to 4 digit number. That is already present in regex formula.
@@techdose4u no I meant in a ipv6 address like 12::45ef
This video is amazing!
Thanks :)
One doubt. Why we have to take range 200-249 and 250-255 ? Why can't we take 2[0-5][0-5] for 3 digits?
Can someone explain me where in this regex pattern of v4 its checking that it will not start from 0
sir, what approach will be expected for this question in an interview? will the interviewers expect us to know this technique?
No. I don't prefer regex because I can't remember. So use something less optimal or using if-else.
12:07 for those who know regex and are in for just the solution of the problem.
is regex library allowed on all coding tests?
If STL is allowed then regex will be allowed.
bro thank u for giving details knowledge of regex function,but i have bit doubt that after making three digit i.e1(0-9)(0-9) cann't we make a range directly from 200 to 255?here u are spliting it i.e from 200 to 249 and then 249 to 255
You can't make for the 3rd digit. Just try it :) You will get it once you write.
@@techdose4u no i am telling that why u have split it up into two things,that is from 200 to 249 and 249 to 255
bro we need to split 200-255 into 200-249 and 250-255 because if you write 2[0-5][0-5] instead of splitting then your regex will fail for integers like 219,238 etc as highest limit is till 5 only ...i hope you got my point.
Sir my one doubt is that sir you do not consider 000.038.098.098 (MEANS ZERO ) is not consider to be an ip address but on hackerrank they have consider a zero (000.12.12.034) is an ip . So sir our coding consider to be this will be wrong ? Sir please tell related to this problem coding also
sir what writing software do you use sir?
Inkspace Wacom pro
thank you sir
Brilliant explanation! Perfect. Learning this was crucial for the future. Do you mind if I share this?
Where will you share?
@@techdose4u various social media like FB, or individual contacts who would benefit.
loved the explanation sir , sir i am not able to implemment it in my python code the same regex pattern over there is giving me differnt result, i want to extract IP adresses from a log file
Thanks Sir
Y do we need 25[0-5] and y cant we stop at 2[0-5][0-5]
Goog work! Nice explanation.
But, about IPv6, do you really need to escape colon (:)?
([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4})
But your solution will be accepted, because, there is no special characters in the input string
Any way, great job!
brother your pattern does not work on hackerrank
Can you mention the problem ?
you are amazing:)
Thanks :)
Will this works for Python?
we can also do it by using getline an delimiter technique...
Sir when will you make DP playlist ? From basics ?
Will make videos topicwise. Let me first get this challenge over with.
@@techdose4u Ok sir
you don't need the escape character for the colon.
👍
Good explanation. My only feedback, regex are a higher level. Internally they parse the string and use recursivity. I saw most answers on leetcode parse the string and none used regex.
Yes correct.
2[0-4][0-9]{2} ---> Matching 4 digit numbers. For 6 digit numbers we have to write 2[0-4][0-9]{4}. Please explain sir...
>>> re.search(r"(2[0-4][0-9]{2})","248201")
>>> re.search(r"(2[0-4][0-9]{2})","248201").group()
'2482'
>>>
Sensei😍
😊
10:53 Repeat Expression - explanation and examples are wrong. Eg. [1-9][0-9]{2} - This will not validate 4 digit number. It'll validate 3 digits numbers only. Also 2[0-4][0-9]{2} will not validate 6 digit number; only 4 digit numbers are validated.
Is [0-9 a-b] same as [0-9 | a-b ] ?
Why use 2[0-4][0-9]|25[0-5] instead of 2[0-5][0-5]
[abc] and [a-c] both are same. 🤔🤔
import java.util.regex.Pattern;
public class Test {
public static void main(String[] args) {
String input="aabbccca";
String pattern1= "^[abc]+$";
String pattern2= "^[a-c]+$";
Pattern compile1 = Pattern.compile(pattern1);
Pattern compile2 = Pattern.compile(pattern2);
boolean bothAreSame = false;
if (compile1.matcher(pattern1).find() == compile2.matcher(pattern2).find()){
bothAreSame=true;
}
System.out.println("Both are same::"+bothAreSame);
}
}
Nice explanation