문제

I have 800 line text in my document in Eclipse. I want to format my code like below.

Hi hello (how are you?) -> Hi hello

Another example (5895489 hi again) -> Another example

as you can see I want to delete starts with "(" and ends with ")".

How can I do it in Eclipse with regular expressions?

도움이 되었습니까?

해결책

You can use the following, the replacement value will be an empty value.

search: \s*\([^)]*\)
replace:

Regular expression:

\s*             whitespace (\n, \r, \t, \f, and " ") (0 or more times)
 \(             '('
  [^)]*         any character except: ')' (0 or more times)
 \)             ')'

Note: I added the \s* to match for leading whitespace just in case so that it don't leave trailing whitespace after the replacement is made.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top