
Usando o Notepad ++, procuro encontrar todas as palavras com TODAS AS MAIÚSCULAS começando com sublinhado e convertê-las para maiúsculas e minúsculas adequadas.
Exemplo 1,
Find:
DimCalendarDay_DATE
Replace with:
DimCalendarDay_Date
Exemplo 2,
Find:
DimCalendarDay_YEAR_PERIOD_DAY
Replace with:
DimCalendarDay_Year_Period_Day
Exemplo 3,
Find:
First_Day
Replace with:
First_Day
Já inseri o seguinte em meus critérios de substituição de anúncio de pesquisa do Notepad++:
Find what: [_]\w*[A-Z]\w*[A-Z]\w*
Replace with: \L \u \1
No entanto, o regex acima substitui meu texto encontrado por nada.
Por favor, avise...
Responder1
- Ctrl+H
- Encontre o que:
(_[A-Z])([A-Z]*)(?![A-Z])
- Substituir com:
\u$1\L$2
- verifique Caso de correspondência
- confira Envolver
- verifique expressão regular
- Replace all
Explicação:
(_[A-Z]) # group 1, an underscore followed by a capital
([A-Z]*) # group 2, 0 or more capitals
(?![A-Z]) # negative lookahead, make sure we haven't capital after
Substituição:
\u$1 # uppercased the content of group 1 (i.e. the first letter)
\L$2 # lowercased the content of group 2 (i.e. the rest of the match)
Dado:
DimCalendarDay_DATE
DimCalendarDay_YEAR_PERIOD_DAY
First_Day
Resultado para determinado exemplo:
DimCalendarDay_Date
DimCalendarDay_Year_Period_Day
First_Day
Captura de tela: