Hello Everybody,
Actually I have been searching and trying to find a way to divide the contents of my text document into parts depend on a sentence. If the sentence appears then the string is automatically divided.
For example, I went to the library to look for a book, which has information on how to use regex, the book which has the information, had been already borrowed.
If we say that book has information is our desired sentence then the code will do
the output will be
I went library look
(this is after removing stop words) and then it deletes all the words after that.
Divide the string into chunks
Moderator: General Moderators
Re: Divide the string into chunks
Regex doesn't understand grammar. In fact your example sentence is really two sentences. Regex uses patterns and "book has information" is not a pattern found in your two sentences easily because of the syntax of English. Perhaps if you explained more of what you are trying to do and what a "stop word" is we could try to help. Right now I see no logical way to search for your pattern and get the result you want.zintani wrote:"I went to the library to look for a book, which has information on how to use regex, the book which has the information, had been already borrowed."
If we say that book has information is our desired sentence then the code will do
the output will be
I went library look
(this is after removing stop words) and then it deletes all the words after that.
Re: Divide the string into chunks
Thanks for your reply. What I meant was if there is a possible way to find a substring in a string. Stop words is another topic, has no relation with the question. Sorry to make it complicated.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Divide the string into chunks
strstr() If you have a better example with a little code it would be easier to help.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.