Find, *Don’t find* and Replace

After going a lot behind “Search, Sort, Filter, Group, Paginate”, this is time to talk about “Find and Replace”.

Before we start, I did need a way to “Search and Replace” in a browser!!! After all these years!!!

I was moving something en-mass from one URL to another and the index page needed uniform replacement. I took the source and placed it in Notepad++ and changed the string uniformly. Alas! The source HTML had unicode, which Notepad++ replaced with ??’s. So while pasting it back, I was to lose all unicode data. So I downloaded this Firefox plugin that allowed some replacement functionality – good enough for my job.

Then came another problem. Most links in the list were opening on a different tab but a few of them didn’t. I wanted to get a uniform experience. Within Firefox how do I search all the lines where “target=_Blank” was absent? There wasn’t such a way. So I took the html to my cygwin terminal and did ‘grep -vn’. phew! Yes, finding is important. At times, not finding is important too!

However, this got me ticking. Why should traditional search and replace have so limited functionality? It reminds me of some search and extract library I had written in past. Some of the functionality included:

  • Return “True” if a string is [not] found in a text
  • Return “True” if string2 is [not] found before [after] string1
  • Return “True” if  string3 is [not] found delimited between string1 and string2
  • Return “True” if given words are [not] found in the same order in a text
  • Return “True” if given words are [not] found in a contiguous manner in the same order in a text
  • etc.

Look carefully, some of these can’t be simple regular expression matches – and you don’t expect everyone to know regular expressions either!

Again, we miss “find all telephone numbers in this documents”, “find all IP addresses in this documents”, “find all e-mail addresses in this document” etc. are tremendous value add. Aren’t they?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s