Skip to content

Instantly share code, notes, and snippets.

Created December 31, 2013 16:28
Show Gist options
  • Save anonymous/8199165 to your computer and use it in GitHub Desktop.
Save anonymous/8199165 to your computer and use it in GitHub Desktop.
In attempts to get my string search to be case insensitive i have found a method of translating the text to all lowercase. My problem is i seem to make the translate statement play well with my string search xpath statement, any ideas?
#translate
translate(text(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')
#string search
'//text()[preceding::*[contains(text(),"Monday")] and following::*[contains(text(),"Tuesday")]]'
@mjc
Copy link

mjc commented Dec 31, 2013

can you provide a sample document? or a snippet that should match at least

@darix
Copy link

darix commented Dec 31, 2013

did you try

'//text()[preceding::*[contains(translate(text(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'),"monday")] and following::*[contains(translate(text(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'),"tuesday")]]'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment