regex - how do i extract the string 'myUIBean' from the string 'com.test.pkg1.myUIBean.getName' -


मैं स्ट्रिंग से ' myUIBean ' स्ट्रिंग कैसे निकालूं? ' com.test .pkg1.myUIBean.getName '। मेरे पास समान स्ट्रिंग्स का एक सेट है जिसमें

  com.test.pkg1.myUIBean1.getName com.test.pkg1.myUIBean2.getName com.test.pkg1.myUIBean3.getName   

मुझे आउटपुट होना चाहिए: myUIBean1 myUIBean2 myUIBean3

मैं पैटर्न का उपयोग कर रहा हूं और निकाले गए समूहों को प्रदर्शित कर रहा हूं, लेकिन यह अंतिम वाक्य में 'myUIBean' से पहले सभी पाठ का चयन कर रहा है। मैं उपयोग कर रहा हूँ पैटर्न है: (। *) "+" UIBean "+" (। *)

धन्यवाद अग्रिम में।

कोशिश करें:

 । * \। (MyUIBean। *) \ .. *  

मान लें कि आप जावा का उपयोग कर रहे हैं, ताकि आप निम्न का उपयोग कर सकें:

  पैटर्न पैटर्न = Pattern.compile ("। * \\। (MyUIBean। *) \\ .. * "); Matcher matcher = pattern.matcher ("com.test.pkg1.myUIBean1.getName"); If (matcher.find ()) {System.out.println (matcher.group (1)); }  

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -