put capital after a tag



  • hello
    i would to put in capital the letter which is just after tag <h1>
    i have a lot of <h1> tag with different letters after, not always the same
    is there a solution with notepad++
    thanks



  • @kat75

    As is usually the case, supplying some real data would have helped clarify your situation, but I found that if I took this made-up data:

    <h1>hello</h1> and <h1>there</h1> or <h1>kat75</h1>

    I could change it with a Replace-All action into this:

    <h1>Hello</h1> and <h1>There</h1> or <h1>Kat75</h1>

    with this replacement:

    Find-what: <h1>(.)
    Replace-with: <h1>\U\1
    Search mode: ☑ Regular expression -AND- ☐ . matches newline

    The key part here is obviously the \U (indicating what follows should be converted to uppercase) in the Replace-with.



  • thanks scott
    it works fine
    great thanks



  • More information on these case conversions may be found here in the section on “Boost”.



  • Hello, @kat75, @scott-sumner and All

    And if you want to normalize the text, between the starting and closing tag <h1>, in order to obtain :

    • A first capital letter

    • All the subsequent letters lower-case

    Just use the regex, below :

    SEARCH (?-s)(?<=<h1>)(.)(.*?)(?=</h1>)

    REPLACE \u\1\L\2

    For instance, the line :

    <h1>sMalL</h1>   <h1>tESt</h1>
    

    would be replaced, as below :

    <h1>Small</h1>   <h1>Test</h1>
    

    Remarks :

    • The replacement \U\1\L\2 could have been used, as well ! In fact, the next global case modifier \L stops the previous case modifier action.

    • Now, let’s suppose the replacement \u$0 OR \u\1\2 . Then, only the first letter, of the text, would be changed upper-case. Similarly, the \l form changes the following single character lower-case.

    • For an equivalent regex, using the form \U, you would have needed the regex \U\1\E\2, because the syntax \E, when used in replacement, stops the global case modifiers \L and \U

    Cheers,

    guy038



  • thanks scott and guy



  • Hello
    i have used with success
    Find-what: >(.)
    Replace-with: >\U\1
    Search mode: ☑ Regular expression -AND- ☐ . matches newline
    to put in uppercase all the letters after >

    i would now to put in uppercase all the letters after a . and a space

    i have read the help but dont succeed
    i have tried
    Find-what: . (.)
    Replace-with: . \U\1
    Search mode: ☑ Regular expression -AND- ☐ . matches newline

    but not work



  • Hi, @pouemes44,

    I supposed that it does not work because you forgot to escape the dot regex symbol, in the search part, in order that the regex engine looks for a literal dot character !

    So, try this S/R, below :

    SEARCH (?-s)\.\x20(.)

    REPLACE .\x20\U\1

    Click, either, on the Replace or Replace All button

    Notes :

    • You may use, of course, a simple space character, instead of the \x20 syntax !

    • The (?-s) modifier forces the regex engine to consider that the . matches newline option as to be disabled, even it’s checked, in the Find/Replace dialog !


    An other form could be used :

    SEARCH (?-s)(?<=\.\x20).

    REPLACE \U$0

    Notes :

    • This time, the regex searches a single standard character, ONLY IF it is preceded by a literal dot and a space character ( positive look-behind )

    • In replacement, the whole regex match ( $0 ), is just rewritten, in uppercase

    • With that second S/R, you must, exclusively, use the Replace All button, although I don’t understand, clearly, the reason why :-))

    Cheers,

    guy038



  • thanks guy, with your explanations i continue to learn :-)



  • hello all
    just another question
    how to replace in uppercase all more special characters (accent, cyrillic, chinese, hindi etc)
    by example é by É, б by Б etc
    \U replace in uppercase only common letters
    some ideas?
    thanks


Log in to reply