Question

I tried to append upper case with space in notepad++, and it's work.

From:   GetTeamMemberByID
To: Get Team Member By ID

Search Criteria:

Find: (.)([A-Z]) 
Replace: \1 \2

But now I need to replace the format within specific keywords, how can I do?

e.g.Required keywords is "Description:" & "\r\n" in following sample:

From:

-- =============================================
--  Author: AP-1
--  Create date: 1/16/2014
--  Description:     GetTeamMemberByID
-- =============================================

To:

-- =============================================
--  Author: AP-1
--  Create date: 1/16/2014
--  Description:     Get Team Member By ID
-- =============================================

Thank you for your attention XD

Was it helpful?

Solution

I suggest this regex to replace only those within the Description::

(?:Description:|(?!^)\G).*?[a-z]\K[A-Z]

And replace with $0

regex101 demo

(?:Description:|(?!^)\G) matches Description: or at the end of the previous match.

\K will 'reset' the match so you don't have to put back what you matched previously.

Since . doesn't match newlines by default, you don't have to specify the ending \r\n 'keyword'.

The regex above works on N++ v6.5.2.

OTHER TIPS

just for starters keeping your case in mind. I see that you have camel case present.

so you may check for that and replace accordingly as I have done here :

([A-Z][a-z]+)([A-Z][a-z]+)

replace with \1 \2

notice there is one blank space after \1 and \2

example here : http://regex101.com/r/eF4vG0

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top