Skip to main content

Scare called regex

Thought I will write some thing in android blog. But no, I can not frame words around the post. So it is better to babble/ramble  here.

Regex - Stands for regular expressions. Used in programming languages and scripts for pattern matching of strings. Efficient and ugly. And very very very difficult.

I tried the entire morning to write an expression which gobbles all the text between let us say abc and def. Read stack overflow, blogger posts. Watched youtube videos. I was not getting what I wanted. And I did not have time and patience to learn everything. Because it is very complex. If you have mastered regex, kudos to you.

Then I wrote my own tester, a small android activity which lets you enter text and regex and does pattern matching. ( I realized it is long time since I designed a layout file) After an hour or so I finally got the result. (abc).*?(def). Quite simple. Isn't it.

So back to gobbling of text in my actual program. And gobble it did not. So how come it worked in sample program? Then I realized white spaces aka new lines in this case. So I got another stack help. And finally all my in between text got gobbled.

But that was not end of the story. There was another hiccup. When you are writing some speaking code, you want to pause. Not just stop and restart. How does one pause. I got a listener for that. But the listener will not listen. That took another half a day.

So now I am contented with the result. And I can not edit the material as the text is too small. So rambling. 

Comments

Popular posts from this blog

Someshwara shataka

ಚರಿಪಾರಣ್ಯದ ಪಕ್ಷಿಗೊಂದು ತರು ಗೊಡ್ಢಾಗಲ್ ಫಲಂ ಈವಿದಾ ಮರಗಳ್ ಪುಟ್ಟವೆ ಪುಷ್ಪವೊಂದು ಬಳಲಲ್  ಭ್ರಂಗಕ್ಕೆ ಪೂವಿಲ್ಲವೆ ನಿರತಂ ಸತ್ಕವಿಗೋರ್ವ ಗರ್ವಿದಂ ನೃಪ ತಾಂ ಲೋಭಿಯಾಗಲ್ ನಿಜಂ ಧರೆಯೊಳ್ ದಾತರು ಪುಟ್ಟರೆ ಹರ ಹರಾ ಶ್ರೀ ಚೆನ್ನ ಸೋಮೇಶ್ವರ Will a bird in the wild go hungry just because one fruit tree dries up? If one flower withers, will not the bee get any flowers? If one haughty king is miserly, will there be no patrons (of poetry) on this earth? ಕೆಲವಂ ಬಲ್ಲವರಿಂದ ಕಲ್ತು ಕೆಲವಂ ಶಾಸ್ತ್ರಂಗಳೋದುತಂ ಕೆಲವಂ ಮಾಳ್ಪವರಿಂದ ಕಂಡು ಕೆಲವಂ ಸುಜ್ಙಾನದಿಂ  ನೋಡುತಂ ಕೆಲವಂ ಸಜ್ಜನಸಂಗದಿಂದಲರಿಯಲ್ ಸರ್ವಜ್ಞನಪ್ಪಂ ನರಂ ಪಲವಂ ಪಳ್ಳ ಸಮುದ್ರವೈ ಹಾರ ಹರಾ ಶ್ರೀ ಚೆನ್ನ ಸೋಮೇಶ್ವರ Learning from wise men, reading from good books, observing others  work and learning from good company, these are the ways a man becomes omni-scient (sarvajna - one who knows everything). Just like many streams join together to make an ocean. P.S. 1) If you find some of my wordings in this shataka is wrong, please let me know. It is a 40 year old memory. 2) There are also...

AA

This must really go to facebook page. But since I am currently not in facebook, I am putting it here. If you feel any of your close ones or your friends and relatives are addicts or on the way of being addicts, introduce them to Alcoholic anonymous. They have meetings all over the Bangalore and in other towns in India also.  I have taken this list from AA India site . The site also contains lot of information about alcoholics including a questionnaire to find out if a a person is an alcoholic or not.   BELGAUM ADDRESSES TIMINGS New Life Group.    St, Anthony Kannada High School,    Opp. Fish Market Khanapur Road, Camp Belgaum-590006 Anand – 099026 87947 Sat 6.00 p.m. Back Top BENGALURU ...

ಏನಾದರೂ ಆಗು ಮೊದಲು ಮಾನವನಾಗು

ಏನಾದರೂ ಆಗು ಮೊದಲು ಮಾನವನಾಗು says a kannada poem. We all need to know that and remember that phrase always. Whether it is IS or Sanathana sanstha, do these people not agree that we are all children of God? And if they agree, do they ever think about why HE  would want some of his children to be killed by other children? Did you know that the founder of this Sanstha was a hypnotist earlier and people have filed a case against him saying he uses hypnosis to convince people to join the organization and perpetrate violent acts? We the common men and women need to think about this.  Should we say that Hindu terrorism is justifiable because of the presence of muslim terrorism? And don't we want to become good humans first? With little bit of tolerance?