Strings to E_REG replace Convertor?
Moderator: General Moderators
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
Strings to E_REG replace Convertor?
well i was'nt sure were to post this so here goes
was wondering if there was any regex convertors out there, where it would possibly have 2 input fields you fill them in, post it, and it tells you the regex stuff.
Its a long shot, but this stuff always gives me a headache
Mal
was wondering if there was any regex convertors out there, where it would possibly have 2 input fields you fill them in, post it, and it tells you the regex stuff.
Its a long shot, but this stuff always gives me a headache
Mal
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
Yeah, unfortunately it would be either wholly over-matching, or very hard to write.magicrobotmonkey wrote:holy crap - i think that would be a tough script to write!
For example, lets say the input was:
"CHeeSe11"
and the output was "chs", then there are a number of ways that could be interpreted..
Are we stripping the letter "e"? Are we stripping all vowels?
Are we removing all numbers, only the number 11, or any instance of "1"?
Are we removing the 3rd, 4th, 6th, 7th, and 8th characters in any string, or is that just a coincidence?
Are we removing characters that are lowercase and numbers, or just lowercase, and certain numbers?
There are literally thousands of combinations to consider.
While I do beleive that in time, an army of monkeys could pound out a script that would do such a thing, I don't beleive anyone has yet.
It is far more effective to either learn regex, or ask on a case-by-case basis.
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
If you know the input and you know the output, then just replace the in with the out.
To do what you want, you would need to be able to give the app a pattern definition of the expected output based on the input, which incase you haven't realised yet is in fact regex, so you are right back where you started from.
The simple answer is learn regex!
To do what you want, you would need to be able to give the app a pattern definition of the expected output based on the input, which incase you haven't realised yet is in fact regex, so you are right back where you started from.
The simple answer is learn regex!
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
redmonkey wrote:If you know the input and you know the output, then just replace the in with the out.
To do what you want, you would need to be able to give the app a pattern definition of the expected output based on the input, which incase you haven't realised yet is in fact regex, so you are right back where you started from.
The simple answer is learn regex!
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
one way to "verify" which direction to go in it could be done with multiple examples of inputs and outputs. Another is allowing the user to set flags, like "use 1) alphanumerics 2) alpha 2) numbers 3) character position."
It's a tough subject because, like Roja alluded to, the context in which the person asking for the response varies wildly.
It's a tough subject because, like Roja alluded to, the context in which the person asking for the response varies wildly.