opalelement Posted December 30, 2008 Share Posted December 30, 2008 I know this forum is for REGEX support and not this kind of thing, but this is what I always use for regex and it works great... http://www.gskinner.com/RegExr/ It has a match section and a replace section, and it has a whole list of parts you can use, as well as options like case sensitivity. My favorite part is by far that when you hold the mouse over any part in the column or in what you entered, it describes what it is there for. Quote Link to comment https://forums.phpfreaks.com/topic/138839-here-is-probably-the-best-regex-tool/ Share on other sites More sharing options...
.josh Posted December 30, 2008 Share Posted December 30, 2008 I want to see a regex tool where you can enter in the subject, and highlight a portion of it, and it show various ways to express it with regex. Like for instance, if I were to highlight in this post the word "and" it would show some suggestions with descriptions, like: literal: and 3 letter word: \b\w{3}\b word starting with 'a' : \ba\w* etc... Quote Link to comment https://forums.phpfreaks.com/topic/138839-here-is-probably-the-best-regex-tool/#findComment-725980 Share on other sites More sharing options...
opalelement Posted December 30, 2008 Author Share Posted December 30, 2008 I want to see a regex tool where you can enter in the subject, and highlight a portion of it, and it show various ways to express it with regex. Like for instance, if I were to highlight in this post the word "and" it would show some suggestions with descriptions, like: literal: and 3 letter word: \b\w{3}\b word starting with 'a' : \ba\w* etc... You just gave me an idea for a PHP script to make:) Anything you can think of besides the following ways? ...-letters starts/ends with letter(...) comes before/after word ... has this(...) symbol in it Quote Link to comment https://forums.phpfreaks.com/topic/138839-here-is-probably-the-best-regex-tool/#findComment-725990 Share on other sites More sharing options...
nrg_alpha Posted December 30, 2008 Share Posted December 30, 2008 It's admittedly a nice enough looking tool.. yet I feel it is akin to a WYSIWYG editor. I personally prefer to get my coding hands in there and dirty by manually typing it out and testing from there. Call me old fashioned. Quote Link to comment https://forums.phpfreaks.com/topic/138839-here-is-probably-the-best-regex-tool/#findComment-726058 Share on other sites More sharing options...
.josh Posted December 30, 2008 Share Posted December 30, 2008 It's admittedly a nice enough looking tool.. yet I feel it is akin to a WYSIWYG editor. I personally prefer to get my coding hands in there and dirty by manually typing it out and testing from there. Call me old fashioned. bah. I like the real time highlighting as I type it in. IMO it helps me build a regex faster, because I can see that hey, this thing right here is(n't)? matching what I want it to match - as opposed to having to sort through a long string of whatever nested groups I have, trying to sort out where it went wrong. Quote Link to comment https://forums.phpfreaks.com/topic/138839-here-is-probably-the-best-regex-tool/#findComment-726198 Share on other sites More sharing options...
opalelement Posted January 1, 2009 Author Share Posted January 1, 2009 It's admittedly a nice enough looking tool.. yet I feel it is akin to a WYSIWYG editor. I personally prefer to get my coding hands in there and dirty by manually typing it out and testing from there. Call me old fashioned. bah. I like the real time highlighting as I type it in. IMO it helps me build a regex faster, because I can see that hey, this thing right here is(n't)? matching what I want it to match - as opposed to having to sort through a long string of whatever nested groups I have, trying to sort out where it went wrong. before I found this I would have to make a php script with an example text and then a bunch of replace/match sets and echo them, then look for whichever one matched what I needed. Quote Link to comment https://forums.phpfreaks.com/topic/138839-here-is-probably-the-best-regex-tool/#findComment-727549 Share on other sites More sharing options...
.josh Posted January 1, 2009 Share Posted January 1, 2009 I'm mostly not impressed by it because it isn't hard to make something like that. The 'hardest' part of it is the 'real time' part in which you would have to use some ajax or flash. You could make something like that completely server side with just a submit button to update, in a few lines of code (minus layout, of course). Quote Link to comment https://forums.phpfreaks.com/topic/138839-here-is-probably-the-best-regex-tool/#findComment-727555 Share on other sites More sharing options...
opalelement Posted January 1, 2009 Author Share Posted January 1, 2009 Well at the moment I am in the middle of a project so I wouldn't make that anytime soon Quote Link to comment https://forums.phpfreaks.com/topic/138839-here-is-probably-the-best-regex-tool/#findComment-727634 Share on other sites More sharing options...
.josh Posted January 2, 2009 Share Posted January 2, 2009 See look. Not very pretty but a couple lines of code is all it really takes. Couple more lines of code for multi-colored highlighting (for multiple group captures). Throw on some ajax for 'realtime' highlighting. Use some css to make it look pretty. Boom, you're done. <form action = '' method = 'post'> Pattern:<br/> ~<input type = 'text' name = 'pattern' size= '55' value = '<?=$_POST['pattern']?>' />~ <input type = 'text' name = 'modifiers' size = '2' value = '<?=$_POST['modifiers']?>' /><br/> Subject:<br/> <textarea name = 'subject' cols = '50' rows = '10'><?=$_POST['subject']?></textarea><br/> <input type = 'submit' value = 'submit'> </form> <?php if ($_POST['pattern'] && $_POST['subject']) { $pattern = $_POST['pattern']; $subject = $_POST['subject']; $m = trim($_POST['modifiers']); $hSubject = preg_replace("~$pattern~$m","<font color = 'gray'>|</font><font style='background-color: yellow'>$0</font><font color = 'gray'>|</font>",$subject); echo nl2br($hSubject); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/138839-here-is-probably-the-best-regex-tool/#findComment-727732 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.