java regex : getting a substring from a string which can vary

后端 未结 5 1640
借酒劲吻你
借酒劲吻你 2021-01-22 19:53

I have a String like - \"Bangalore,India=Karnataka\". From this String I would like to extract only the substring \"Bangalore\". In this case the regex

5条回答
  •  青春惊慌失措
    2021-01-22 20:49

    If you are only interested to check that "Bangalore" is contained in the string then you don't need a regexp for this.

    Python:

    In [1]: s = 'Bangalorejkdjiefjiojhdu'
    
    In [2]: 'Bangalore' in s
    Out[2]: True
    

提交回复
热议问题