java - jSoup - Is it possible to match elements with a minimum attr() length? -


i can match elements in jsoup easily, then, after fact, need check these values see if @ least longer 1 character.

i wondering if there way match elements specific attribute, if attribute's content length longer 1 character?

hopefully allow me not have manually check lengths myself.

document.select("img[src]") 

the above matches img tags src attribute, attributes may blank , i'd rather not have them match @ all.

pseudo code explaining mean:

document.select("img[src:length(1)]") 

i have looked through reference, cannot find suitable - except perhaps regex solution?

http://jsoup.org/apidocs/org/jsoup/select/selector.html

thanks, mikey.

[attr~=regex] elements attribute named "attr", , value matching regular expression

based on source link provided, this

document.select("img[src~=.+]"); 

this should result in selection of img elements src attribute of 1 character or more.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -