[Advanced-java] Regular Expression - again
Jan-Oliver Wuelfing
Jan-Oliver.Wuelfing at scai.fraunhofer.de
Tue Jun 3 04:05:35 PDT 2008
A Good One to all,
I did not get a clue; maybe you can help me again:
Here is a snippet of my input
#integer">1300#offersDiskStorage</uri>
#string">GB (per user)#offersDatabaseServer</uri>
#string">Postgre SQL#offersNumberOfNodes</uri>
#integer">4#offersConnectivityVia</uri>
#string">MB#offersNodeBandwidth</uri>
#string">MBit/s#offersDiskStorage</uri>
#integer">3#offersDiskStorage</uri>
#string">GB (in total)#offersDiskStorage</uri>
#string">2000#hasFrequency</uri>
#string">n/a
I like to search for the substring 'Storage' and iff after the tag
follows a digit like '2000', I would like to extract this substring,
namely '2000'.
I have more than this one input. It is all the same schema but with
other digits, so I cannot just search for the '2000'.
I think I could do this with a RE like .match("[0-9]") but it does not
work, because it is not possible a associate those kind of a match with
a specific position.
for (int z = ro_cand.indexOf("Storage"); z < ro_cand.length(); z++) {
if (ro_cand.matches("[0-9]") == ro_cand.charAt(z)) {
com_str = ro_cand.substring(ro_cand.indexOf("[0-9]", z),
ro_cand.indexOf("#", z));
}
}
Do you have any suggestions?
Many thanks again
Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Jan-Oliver.Wuelfing.vcf
Type: text/x-vcard
Size: 369 bytes
Desc: not available
Url : /lists/advanced-java/attachments/20080603/0c382004/attachment.vcf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3778 bytes
Desc: S/MIME Cryptographic Signature
Url : /lists/advanced-java/attachments/20080603/0c382004/attachment.bin
More information about the Advanced-java
mailing list