depends entirely on what you are trying to capture - is the "edit" always there? is the /admin/users/ always there?
in general I'm a great fan of http://www.w3schools.com/ but not sure what to recommend for regular expressions in general - most sites are confusing rather than educational for the novice :) you can try http://www.w3schools.com/jsref/jsref_obj_regexp.asp On 19 August 2010 14:26, Erwin <[email protected]> wrote: > I tried the following > > var editRegExp = /(^.*?)([^\/]*)\/edit\?(.*$)/; > > var edit_link = $('edit_user').down('a'); > var match = editRegExp.exec(edit_link.href.toString()); > > on this url : > > /admin/users/4c6a275ea326cb01f4000001/edit?locale=en > > seems to work , maybe a better writing ? > > > > On 19 août, 15:10, Erwin <[email protected]> wrote: >> Hi Dave .. sorry to ask you an additional trick ... but as you are >> qui good in RegExp ... >> >> what if the href is as following : >> >> /admin/users/4c6a275ea326cb01f4000001/edit?locale=en >> >> in this case (^.*?) is getting the 'edit' string, not the id number : >> 4c6a275ea326cb01f4000001 >> >> btw : which tutorial do you recommend to get a better understanding of >> RegExp ..? (I found some of them w good explanation but few >> examples;..) >> >> erwin >> >> On 18 août, 19:27, Dave Kibble <[email protected]> wrote: >> >> >> >> > you might find this regular expression useful: >> >> > var myRegExp = /(^.*?)([^\/]*)\?(.*$)/; >> > var match = myRegExp.exec(link.href.toString()); >> > alert(match[1] + '\n' + match[2] + '\n' + match[3]); > > -- > You received this message because you are subscribed to the Google Groups > "Prototype & script.aculo.us" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/prototype-scriptaculous?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
