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.
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
Post a Comment