Is it possible to "breed" a correct regular expression so that you
don't have to go to the trouble of actually working it out for yourself?
The answer seems to be "yes", and the result could even be better than
the one you created by hard logical thinking.
When you construct a computer program you do so through a series of well defined instructions that work on a set of data and produce a desired outcome.
Given our focus here is on regular expressions, let's say that our goal is to match just the alphanumeric characters of the string:
'http://www.google.com'.
Sticking to the traditional way we would have to supply an instruction in the form of a regular expression, that is '/[a-zA-Z]/g'
But what if we could start the other way around? That is, get the computer to solve problems without being explicitly programmed?
How can this be done?
With Genetic Programming we can tell a computer program what we're after and let it generate a new program for us that will produce the same outcome as we had done it ourselves.
full article on i-programmer
When you construct a computer program you do so through a series of well defined instructions that work on a set of data and produce a desired outcome.
Given our focus here is on regular expressions, let's say that our goal is to match just the alphanumeric characters of the string:
'http://www.google.com'.
Sticking to the traditional way we would have to supply an instruction in the form of a regular expression, that is '/[a-zA-Z]/g'
But what if we could start the other way around? That is, get the computer to solve problems without being explicitly programmed?
How can this be done?
With Genetic Programming we can tell a computer program what we're after and let it generate a new program for us that will produce the same outcome as we had done it ourselves.
full article on i-programmer
Comments