laanes Posted June 10, 2011 Share Posted June 10, 2011 Can anyone help me to figure out a pattern that matches all the underlined zn's ? mnzertainlyzn cznar availznable in zn finznish zn / zn, zn/zn zn umzn:) I tried this: '#\s?zn\s?#' This is close to what i expect but matches also the ones contained inside words which i don't want. Quote Link to comment Share on other sites More sharing options...
fugix Posted June 10, 2011 Share Posted June 10, 2011 for that line of text there you would want /\/?|\s?[zn]/ Edit: revised the code, and of course you can use whatever delimiters you'd like Quote Link to comment Share on other sites More sharing options...
requinix Posted June 10, 2011 Share Posted June 10, 2011 Not quite right. Using \b as a word boundary, /\bzn/ Quote Link to comment Share on other sites More sharing options...
fugix Posted June 10, 2011 Share Posted June 10, 2011 Not quite right. Using \b as a word boundary, /\bzn/ Nice, didn't even think of using a word boundary for some reason. Short and sweet solution Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted June 11, 2011 Share Posted June 11, 2011 I'm guessing you'd want it to not match znasdsfs but the above will, so using a second word boundary after it will solve it /\bzn\b/ Quote Link to comment Share on other sites More sharing options...
laanes Posted June 11, 2011 Author Share Posted June 11, 2011 Thanks guys! Now my script is singing and dancing. You are the best! Greetings, laanes Quote Link to comment 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.