replace all text in a bracket
-
Hi
Please let me know how to replace all text in a bracket.
Example
xxxx ( xxxx xxx )
Replaced with
xxxx ( yyyyyyy ) -
@daniel-Louwrens said in replace all text in a bracket:
Hi
Please let me know how to replace all text in a bracket.
Example
xxxx ( xxxx xxx )
Replaced with
xxxx ( yyyyyyy )Sorry, I should have mentioned that the words in the bracket will be varied for
all instances. -
There is a generic formula created available in the FAQ section, see this post and the link from there called “Replacing in a specific zone of text”. Try that.
Also when posting these types of questions it is preferable to insert examples in a specific method, please read the post pinned to this section called “Please Read this before Posting”.
Terry
-
Hi
I have had a look at the FAQs and the recommended methods for posting
but I am still unsure how to proceed.Using Search/find in files then Find What…
Name ( “BTI_BCNA” ) text will be different every time, always in inverted commas
Replace with
Name ( “Loose Consist” ) This will be the same every time
I hope that clarifies the question
Regards
Daniel
-
@daniel-Louwrens said in replace all text in a bracket:
I have had a look at the FAQs and the recommended methods for posting
but I am still unsure how to proceed.I don’t know if you are unwilling or unable to post examples correctly. Regardless I will give you a possible solution. If it doesn’t work it will be because you didn’t post the examples as requested. Not showing examples in the format requested is often the main cause for failure of the solution, so be it!
Whilst this doesn’t look anything like the other post I referred to, it does follow reasonably well. This solution will only work for your example, whereas the other post has to cater for lots of different scenarios, hence it looks more complicated.
Find What:
\([^)]+
Replace With:\( xyz
This used the Replace function, search mode is set to “regular expression”. You can copy and paste the red text above into the respective fields. Obviously
xyz
isn’t correct, you will need to replace that with what you want to insert as the replacement text.Good luck
Terry -
@daniel-Louwrens said in replace all text in a bracket:
I have had a look at the FAQs and the recommended methods for posting
but I am still unsure how to proceed.Using Search/find in files then Find What…
Name ( “BTI_BCNA” ) text will be different every time, always in inverted commas
Replace with
Name ( “Loose Consist” ) This will be the same every time
Try:
Find what:
(Name\s*\(\s*")(.*?)("\s*\))
Replace with:\1Loose Consist\3
That’s assuming the text before the open parenthesis is always “Name”; if it varies, try removing
(Name\s*
from the beginning and see if it selects what you want without selecting things you don’t want. -
@Coises said in replace all text in a bracket:
@daniel-Louwrens said in replace all text in a bracket:
I have had a look at the FAQs and the recommended methods for posting
but I am still unsure how to proceed.Using Search/find in files then Find What…
Name ( “BTI_BCNA” ) text will be different every time, always in inverted commas
Replace with
Name ( “Loose Consist” ) This will be the same every time
Try:
Find what:
(Name\s*\(\s*")(.*?)("\s*\))
Replace with:\1Loose Consist\3
That’s assuming the text before the open parenthesis is always “Name”; if it varies, try removing
(Name\s*
from the beginning and see if it selects what you want without selecting things you don’t want.Hi
I tried a find and replace using the exact chars you suggested but
the program showed 0 replaced.Cheers
Daniel
-
@daniel-Louwrens said in replace all text in a bracket:
I tried a find and replace using the exact chars you suggested but
the program showed 0 replaced.Did you set the search mode to regular expression?
If that isn’t the issue then you need to provide the examples via the requested method. Follow that post I referred to, otherwise you are just wasting people’s time on this forum (who do want to help).
Terry