Results 1 to 3 of 3
- 11-10-2009, 05:39 PM #1
Member
- Join Date
- Nov 2009
- Posts
- 8
- Rep Power
- 0
java regular expression to search block/string/word exist in a paragraph?
Hi ,
i am new to java regular expression.
Consider the follwoing paragraph :
The Internet is a global system of interconnected computer networks that use the standardized Internet Protocol Suite (TCP/IP) to serve billions of users worldwide. It is a network of networks that consists of millions of private and public, academic, business, and government networks of local to global scope that are linked by copper wires, fiber-optic cables, wireless connections, and other technologies. The Internet carries a vast array of information resources and services, most notably the inter-linked hypertext documents of the World Wide Web (WWW) and the infrastructure to support electronic mail. In addition it supports popular services such as online chat, file transfer and file sharing, gaming, commerce, social networking, publishing, video on demand, and teleconferencing and telecommunications. Voice over Internet Protocol (VoIP) applications allow person-to-person communication via voice and video.
The origins of the Internet reach back to the 1960s when the United States funded research projects of its military agencies to build robust, fault-tolerant and distributed computer networks. This research and a period of civilian funding of a new U.S. backbone by the National Science Foundation spawned worldwide participation in the development of new networking technologies and led to the commercialization of an international network in the mid 1990s, and resulted in the following popularization of countless applications in virtually every aspect of modern human life. As of 2009, an estimated quarter of Earth's population uses the services of the Internet.
I need to do the following :
1. To search a given block of text exist
For example :
Search the follwing block exist
", and other technologies. The Internet carries a vast array of information resources and services, most notably the inter-linked hypertext documents of the World Wide Web (WWW) and the infrastructure to support electronic mail. In addition it supports popular services such as online chat, "
2. To search a string or block of text exist
For example :
Search the string
"World Wide Web (WWW) and the infrastructure to support electronic mail. "
OR search the block of text in above (point 1).
3.Search if the given block of text or string doesn't exist :
For example :
Follwoing string shouldn't exist :
Voice over Internet Protocol (VoIP) applications allow person-to-person communication via
4.Search a given word exist or shouldn't exist .
Please help me to resolve the above regular expression.
- 11-10-2009, 05:43 PM #2
This doesn't really sound like a regular expressions problem, more of a "does a given string contain, or not contain a specific substring"
For example,
Java Code:String allTheText = "The Internet is a global system...."; // that paragraph you had // for #1 String findText = ", and other technologies. ..."; // that block of text you want to find boolean blockExits = allTheText.indexOf(findText) >= 0;
- 11-11-2009, 05:56 AM #3
Member
- Join Date
- Nov 2009
- Posts
- 8
- Rep Power
- 0
i agree with you .But indexOf(String) will search for a exact pattern ..here i may give the string with spaces or with quotes .. how to achieve this kind of operations ..i need a common API for which i pass my block and the paragraph .Finally the API should return which contains the specified block or not ..(the block may be set of words , a word ...)
please help me ..
Similar Threads
-
Java Regular expression ?
By sidharth in forum Advanced JavaReplies: 12Last Post: 11-14-2009, 11:09 AM -
Java Regular Expression help
By royalibrahim in forum Advanced JavaReplies: 11Last Post: 11-12-2009, 01:27 AM -
Validating url with regular expression??
By kirtichopra2003 in forum Advanced JavaReplies: 2Last Post: 10-07-2009, 01:29 PM -
regular expression
By ras_pari in forum Advanced JavaReplies: 27Last Post: 10-07-2009, 12:25 PM -
need help to make this regular expression
By aruna1 in forum New To JavaReplies: 1Last Post: 04-12-2009, 08:09 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks