Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to get only numeric values from text
#8
Solved: 11 Years, 4 Months ago
Lines of code are not the only measure of a solution. Accuracy, flexibility, ease of understanding are important as well. Regular expressions are great for dealing with ambiguity in data. Regular expressions are quite flexible and can match many variations on a data "theme". However, regular expressions often do not do as well in the "ease of understanding" area as other solutions, and, as you pointed out, they may not be as efficient as other solutions.

We run our test sets overnight, unattended. For us, speed of execution is secondary. What does the poster plan to do with the data once it is parsed? Write it to another file? That is much, much slower than the regular expression and so the regular expression is a smaller percentage of the total execution time.

I am not arguing that a regular expression is the best or only solution here, but it is a good solution if the data format is varied as the examples suggest. If the data is NOT as varied as the examples suggest (i.e., there are typos in the example), then a regular expression would be overkill - like bringing in the USS Enterprise to kill a mouse.

It does provide more information to the poster about ways to tackle the problem and, hopefully, expands the poster's knowledge of QTP a little.
Reply


Messages In This Thread
RE: how to get only numeric values from text - by tdevick - 03-11-2011, 11:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need to Validate Text filed is blank after clicking on the Text box balak89 3 4,905 09-13-2015, 12:06 AM
Last Post: ADITI1992
  Validate Numeric value is displaying expected format kalaivanan123 1 3,508 09-23-2013, 08:45 PM
Last Post: ravi.gajul
  I am trying to extract text from a webelement but it is generating blank text scenari excellentpawan 2 4,674 08-13-2013, 08:37 PM
Last Post: excellentpawan
  how to pass a numeric value into webedit silpavinod 3 3,867 10-15-2012, 01:57 PM
Last Post: silpavinod
  Need help on numeric value display AutomationTester2011 3 3,222 07-19-2011, 05:40 PM
Last Post: rajpes

Forum Jump:


Users browsing this thread: 6 Guest(s)