Remove parentheses from string java


Jul 10, 2016 · The problem uses a BFS approach. Each iteration we remove one parenthesis from the string. Check if it is valid, if it is, then the length of the substring is the length of all valid answers (all shorter substring requires removing more parenthesis). I'm trying to do a replaceAll to remove all quotes and parentheses, but retain the "@" sign and commas. How do I do this? I have this: replaceAll("[^a-zA-Z]", "") which is horrendously stripping my string of email addresses of all punctuation marks that are not letters. Please help! Thank you, Jamie leetcode Remove Invalid Parentheses 2015年11月6日 2015年11月6日 hrwhisper 1 Comment 13,241 views Remove the minimum number of invalid parentheses in order to make the input string valid. How can i do this in java : given a string, for each text in parenthesis, if it contains "blabla" then remove all text in these parenthesis including parenthesis themselves I'm trying to do a replaceAll to remove all quotes and parentheses, but retain the "@" sign and commas. How do I do this? I have this: replaceAll("[^a-zA-Z]", "") which is horrendously stripping my string of email addresses of all punctuation marks that are not letters. Please help! Thank you, Jamie Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note: The input string may contain letters other than the parentheses ( and ).