Split using multiple keywords as demiliters

Anjan Baradwaj

This question answers how we can split a string using multiple delimiters? Is it also possible to split a String using multiple keywords.

For example:

String myString = (One Two Three) AND (Four Five Six) OR (Six Seven Eight)

And I want to split myString at both AND and OR so that I get:

  someArray[0] = (One Two Three)

  someArray[1] = (Four Five Six)

  someArray[2] = (Six Seven Eight)

I do not know much of regex, so any help or advice would be helpful. Thanks in advance.

Mifmif

Try this :

String[] someArray=yourString.split("(AND)|(OR)");

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Split using multiple keywords using regex

From Dev

Recognizing multiple keywords using PocketSphinx

From Dev

how to split a string which has multiple repeated keywords in it to an array in javascript?

From Dev

Using multiple keywords in pyplot.axis in matplotlib

From Dev

Chrome extension using multiple omnibox keywords

From Dev

Using multiple keywords in xattr via _kMDItemUserTags or kMDItemOMUserTags

From Dev

search through a database using multiple keywords in php

From Dev

Using excel search function while there are multiple keywords

From Dev

AngularJS search multiple keywords using one field

From Dev

JavaScript – Issue using multiple keywords with RegExp

From Dev

Matching multiple keywords using contains() in jQuery

From Dev

Using String.split to split with multiple conditions

From Dev

Split by whitespace Except KeyWords

From Dev

Using regular expression for fetching multiple keywords using python 3.4

From Dev

Using multiple delimiters for .split in Java

From Dev

avoid using multiple split method

From Dev

Using .split() for multiple characters in Java

From Dev

Split String using multiple Selectors

From Dev

How to extract multiple line strings between two keywords using grepwin

From Dev

Search SQL database using multiple keywords entered in a TextBox

From Dev

How to split string by specific keywords?

From Dev

How to split string by specific keywords?

From Dev

Elasticsearch Multiple Prefix Keywords

From Dev

Multiple keywords search

From Dev

Filter multiple keywords

From Dev

Search a text for multiple keywords

From Dev

merge multiple keywords into a string

From Dev

MySQL Searching For Multiple Keywords

From Dev

Regexp for multiple keywords matching

Related Related

  1. 1

    Split using multiple keywords using regex

  2. 2

    Recognizing multiple keywords using PocketSphinx

  3. 3

    how to split a string which has multiple repeated keywords in it to an array in javascript?

  4. 4

    Using multiple keywords in pyplot.axis in matplotlib

  5. 5

    Chrome extension using multiple omnibox keywords

  6. 6

    Using multiple keywords in xattr via _kMDItemUserTags or kMDItemOMUserTags

  7. 7

    search through a database using multiple keywords in php

  8. 8

    Using excel search function while there are multiple keywords

  9. 9

    AngularJS search multiple keywords using one field

  10. 10

    JavaScript – Issue using multiple keywords with RegExp

  11. 11

    Matching multiple keywords using contains() in jQuery

  12. 12

    Using String.split to split with multiple conditions

  13. 13

    Split by whitespace Except KeyWords

  14. 14

    Using regular expression for fetching multiple keywords using python 3.4

  15. 15

    Using multiple delimiters for .split in Java

  16. 16

    avoid using multiple split method

  17. 17

    Using .split() for multiple characters in Java

  18. 18

    Split String using multiple Selectors

  19. 19

    How to extract multiple line strings between two keywords using grepwin

  20. 20

    Search SQL database using multiple keywords entered in a TextBox

  21. 21

    How to split string by specific keywords?

  22. 22

    How to split string by specific keywords?

  23. 23

    Elasticsearch Multiple Prefix Keywords

  24. 24

    Multiple keywords search

  25. 25

    Filter multiple keywords

  26. 26

    Search a text for multiple keywords

  27. 27

    merge multiple keywords into a string

  28. 28

    MySQL Searching For Multiple Keywords

  29. 29

    Regexp for multiple keywords matching

HotTag

Archive