• Extract eMail and Telephone Nr.

    6
    0 Votes
    6 Posts
    597 Views
    guy038G

    Hello @ahmed-izler and All,

    Here is my solution… with regexes, of course ;-))

    So, given this example, below, where :

    Three sections, out of five, end with Option 2

    A variable amount of empty lines, even 0, exists between sections

    Two sections are preceded with leadings space and tabulation characters

    vorname: Alfred nachname: Weber geburtsdatum: 17.01.1981 Strasse: Wolfgangstraße HausNr: 12 PLZ: 45598 Wohnort: Essen Etage: EG Lage: links Tel: 0176048784263 email: richardweber1m@yahoo.com IBAN: DE4XXXXXXXXXXXXXXXXX5 XXXXXXXXXX Option 2 vorname: Alfred nachname: Weber geburtsdatum: 17.01.1981 Strasse: Wolfgangstraße HausNr: 12 PLZ: 45598 Wohnort: Essen Etage: EG Lage: links Tel: 0176048784263 email: richardweber1m@yahoo.com IBAN: DE4XXXXXXXXXXXXXXXXX5 XXXXXXXXXX vorname: Alfred nachname: Weber geburtsdatum: 17.01.1981 Strasse: Wolfgangstraße HausNr: 12 PLZ: 45598 Wohnort: Essen Etage: EG Lage: links Tel: 0176048784263 email: richardweber1m@yahoo.com IBAN: DE4XXXXXXXXXXXXXXXXX5 XXXXXXXXXX Option 2 vorname: Alfred nachname: Weber geburtsdatum: 17.01.1981 Strasse: Wolfgangstraße HausNr: 12 PLZ: 45598 Wohnort: Essen Etage: EG Lage: links Tel: 0176048784263 email: richardweber1m@yahoo.com IBAN: DE4XXXXXXXXXXXXXXXXX5 XXXXXXXXXX vorname: Alfred nachname: Weber geburtsdatum: 17.01.1981 Strasse: Wolfgangstraße HausNr: 12 PLZ: 45598 Wohnort: Essen Etage: EG Lage: links Tel: 0176048784263 email: richardweber1m@yahoo.com IBAN: DE4XXXXXXXXXXXXXXXXX5 XXXXXXXXXX Option 2

    Open the Replace dialog ( Ctrl + H )

    SEARCH (?s)^\h*vorname:.+?(\R)(\h*Tel:\h+.+?\R\h*email:\h+.+?\R).+?\R(\h*Option 2\R*)?(?=\h*vorname:|\z)

    REPLACE ?3\2\1

    Tick the Wrap aroud option, if necessary

    Select the Regular expression search mode

    Click on the Replace All button, or several times on the Replace button

    You’ll get this output, with the indentation kept :

    Tel: 0176048784263 email: richardweber1m@yahoo.com Tel: 0176048784263 email: richardweber1m@yahoo.com Tel: 0176048784263 email: richardweber1m@yahoo.com

    So, @ahmed-izler, if this result is the one that you expect to, I’ll give you some hints on the regex S/R, next time !

    Best Regards

    guy038

  • Macro to clear RO and Format XML

    3
    0 Votes
    3 Posts
    804 Views
    PeterJonesP

    I said,

    For me, the Pretty Print command is ID=22137

    Sorry, I forgot, I was going to explain how I found that: I have the plugin NppUISpy installed; using its interface, I was able to find that ID number.

    Note: many of the same points regarding plugin commands in macros were brought up in this discussion from Jun 2020.

  • How notepad ++ recover file information from an 'web' exploreur?

    5
    0 Votes
    5 Posts
    210 Views
    Noemie MalgogneN

    @PeterJones Thanks for your detailed answer. I feel like a beginner and you’re right, I probably misunterstand the differences between web and desktop developpment. Thanks a lot for the links, whose I will read with attention and I hope that will help me to find the solution!
    ( for the joke, I,ve tried to find what I want in the code source but I’m not gifted apparently :D)

  • HyperLink

    2
    0 Votes
    2 Posts
    152 Views
    Alan KilbornA

    @sadicus

    Not sure at all what you mean.

    But… the way hyperlinks work has undergone revision in recent versions in order to work better.

    Probably some “side effect” with the way the old stuff worked allowed you to do whatever it is you liked.

    I would not count on any of that old behavior making a return appearance.

  • "Special characters" in Search Results window (encoding issues?)

    19
    2 Votes
    19 Posts
    2k Views
    Alan KilbornA

    @PeterJones said in "Special characters" in Search Results window (encoding issues?):

    If you added

    First, I’m a bit surprised that after adding that line manually, that Notepad++ allows it to remain (after recording a new macro, forcing N++ to rewrite shortcuts.xml).

    Second, it was a good idea, but sadly, after trying it, I get the same result as earlier, specifically, “garbage” characters in the Find result window text.

    Third, thanks for the interest, @PeterJones

  • Find and Replace: Multiple Replacements in Part of a String

    11
    1 Votes
    11 Posts
    543 Views
    guy038G

    Hello, @anos, @terry-r, @alan-kilborn, @peterjones and All,

    And here is my solution !

    If we use the FREE-SPACING mode (?x), for the SEARCH part : SEARCH (?x-s) (?: ( \+A (\*)? ) | ( \+B (\*)? ) | (2) ) (?!.*,) Groups --> No 1 2 3 4 5 Look-Ahead REPLACE (?1(?{2}1:a))(?3(?{4}2:b))?5X BEWARE that, in the REPLACE part, the FREE-SPACING mode is FORBIDDEN. So, ONLY for INFO : REPLACE ( ?1 ( ?{2} 1 : a ) ) ( ?3 ( ?{4} 2 : b ) ) ?5 X

    and given the data :

    12345-01, A+A*2B+B*+A 12345-02, A+AB+B*+AA

    it would return :

    12345-01, A1XB2a 12345-02, AaB2aA

    Notes :

    The first part (?x-s) of the regex search means that :

    The free-spacing mode is set ( Spaces are not taken in account, except for the [ ] syntax or an escaped space char )

    Due to (?-s) syntax, the dot regex symbol matches a single standard char only ( not an EOL char )

    Then, the (?:......) syntax defines a non-capturing group

    Now, in this non-capturing group, we have 3 alternatives and the first two contain an optional inner group (\*)? ( Remember that the ? is an other form of the {0,1} quantifier )

    To end, all this regex , so far, will match ONLY IF the final negative look-ahead structure (?!.*,) is verified, that is to say if at current position, reached by the regex engine, there is never a comma, at any further position, in current line

    Now, in the replacement regex :

    The (?1(?{2}1:a)) syntax means that if  group 1 exists, then if  group 2 exists, then  write 1 else  write a

    The (?3(?{4}2:b)) syntax means that if  group 3 exists, then if  group 4 exists, then  write 2 else  write b

    Finally, the ?5X means that if  group 5 exists, then  write an X ( The parentheses are not mandatory as this part ends the regex

    Note also that it’s not necessary to surround the groups 1, 3 and 5 with braces as these groups are not immediately followed with a digit !

    Best Regards,

    guy038

  • Find/Replace number with Increment Value

    12
    0 Votes
    12 Posts
    1k Views
    guy038G

    Hello @peterjones, @DJSpirosG and All,

    I suppose that the regex, in the Python script, is r'^(\\[#)(\d+)(\\])' and NOT r'^(\[#)(\d+)(\])' !!

    If so, Peter, I can edit your post and make the corrections. Just tell me !

    Remark : To explicitly write the literal strings \\[ and \\], in our forum, you need to write them as \\\[ and \\\]

    Note also that, unfortunately, the Preview panel does not show the right layout :-(( Things are OK when you click on the Submit button, only !

    BR

    guy038

    P.S. :

    To write the text, of the Remark line, just above, I needed to write :

    First, 2 consecutive \ before each square bracket !

    Second, 3 consecutive \ before each square bracket !

  • How do I install the emmet plugin in the portable version of notepad ++?

    4
  • How to set tab size for user defined language?

    3
    0 Votes
    3 Posts
    2k Views
    PeterJonesP

    @Mario-Valle ,

    As far as I know, there isn’t a native way in Notepad++ to change the tab setting on a per-UDL basis.

    That would be nice, and in theory, you could put in a feature request. Unfortunately, the UDL system doesn’t often get bug fixes, let alone feature requests.

    However, there may be a workaround; the underlying Scintilla library has a SCI_SETTABWIDTH message, which you can access through a variety of means, including the PythonScript plugin (editor.setTabWidth(2) will change it to two spaces per tab). With some logic, you could write a PythonScript that determines whether the active editor is editing a BiBTeX-UDL-based file, and if so, run that PythonScript setting. If you have PythonScript, or are willing to install it, someone here should be able to give you pointers on how to implement that logic.

    <edit> You might also need to change SCI_SETTABINDENTS, depending on your Settings > Preferences > Language > Tab Settings > [Default] settings </edit>

  • Is there a way to view in split screen the final outcome of my code?

    2
    0 Votes
    2 Posts
    247 Views
    PeterJonesP

    @Joshua-Barbour ,

    Notepad++ is a text editor. It is often used to edit underlying code, but you have to rely on something else (another application, or at least a plugin) to do something with that code.

    You don’t mention what kind of code it is. Is it something like a batch file or Python program which runs using an interpreter? Is it code like c/c++ that needs to be compiled? Is it HTML, which needs to be rendered using a browser? All of those would have a possible answer which might or might not make you happy, but since you give no clue as to which it is, your question is virtually impossible to answer.

  • XML FILE- FIND and REPLACE

    2
    0 Votes
    2 Posts
    124 Views
    Hüseyin Can CömertH

    I have managed to do it. :)
    Thanks anyway.

  • Question about Word wrap spec with tab indented line

    5
    0 Votes
    5 Posts
    307 Views
    S

    @litos81 said in Question about Word wrap spec with tab indented line:

    ExtSettings

    Thank you very much the information.
    I solved it.
    Regards,

  • Run tab question

    2
    0 Votes
    2 Posts
    134 Views
    Alan KilbornA

    @Sara-Uyehara

    You don’t. You use the View menu choices:

    Imgur

    If you have a more-specialized need (e.g., different browser?), post again.

  • Transpose multiple lines Horizontally in rows

    9
    0 Votes
    9 Posts
    859 Views
    Terry RT

    @Akruti-Clinic said in Transpose multiple lines Horizontally in rows:

    No data changed

    I am referring to this
    3027cd08-02f8-4d28-bf77-1c33c8fcc4a0-image.png

    The order of the lines changed and some text was missing, namely Price - which showed on the first line immediately behind chinttt.

    I am thinking that English is not your primary language as the last sentence you wrote i thinks its going more comple will find another, I do not understand. If you are still having issues, explain the problem. As you supplied some “real data” which allowed me to fix the previous problem, maybe you can show further examples where the process did not work and maybe it is still possible to update the solution to accommodate any other need.

    Terry

  • 0 Votes
    6 Posts
    243 Views
    Alan KilbornA

    @Alan-Kilborn said in Let result lines for text search pattern appear only once even if there are more occurrences?:

    change Find what to `foobar(?-s).*

    Bit of an error here, in formatting; THIS:

    Now, the workaround:

    change Find what to `foobar(?-s).* change _Search Mode to Regular expression

    SHOULD BE:

    Now, the workaround:

    change Find what to foobar(?-s).* change Search Mode to “Regular expression”
  • Extend syntax highlighting for a certain language

    10
    0 Votes
    10 Posts
    4k Views
    W

    @PeterJones said in Extend syntax highlighting for a certain language:

    That’s a different problem than adding tags to the list of valid tags.

    Of course it is - after my success with patching langs.xml in order to colour my invented tags, I wanted to go one step further. Now I know that it’s not possible.

    via the script EnhanceAnyLexer.py that @Ekopalypse shares

    Interesting, but for my purposes too complicated. So I’m going to stick with my patched langs.xml, this solves the main problem, the rest would just be “nice to have”.

    Thank you for your support.

    whitecat

  • How to change the theme for an ordinary Windows user?

    7
    0 Votes
    7 Posts
    450 Views
    PeterJonesP

    @PeterJones wonders how well the double negative will translate…

    That’s one of those idiomatic things that each language treats differently…

  • Help me find this menu "open file in browser"

    13
    1 Votes
    13 Posts
    329 Views
    PeterJonesP

    @andrecool-68 said in Help me find this menu "open file in browser":

    I don’t think we understand each other at all.

    I agree.

    However, I am just going to drop it, because we both apparently understand how to make it translate both the menu entry and the shortcut mapper entry, even if we don’t like or agree with the way the other of us has tried to explain it.

  • NppFTP - File attributes

    3
    0 Votes
    3 Posts
    192 Views
    andrecool-68A

    Total Commander has such an option!

  • Recent Files help wanted

    4
    1 Votes
    4 Posts
    162 Views
    PeterJonesP

    @Alan-Kilborn ,

    Sorry, @Alan-Kilborn , I cannot replicate.

    Unzip fresh NPP v7.9.1-64 portable run type a Save> new 1.txt New
    77ea0181-47f2-4e32-8c47-b5676aaef430-image.png Close new 1.txt
    eb55c7e3-a141-410e-af5c-9a23726d2113-image.png Notepad++ v7.9.1 (64-bit) Build time : Nov 2 2020 - 01:07:46 Path : C:\usr\local\apps\npp\npp.7.9.1.portable.x64\notepad++.exe Admin mode : OFF Local Conf mode : ON OS Name : Windows 10 Enterprise (64-bit) OS Version : 1903 OS Build : 18362.1139 Current ANSI codepage : 1252 Plugins : mimeTools.dll NppConverter.dll NppExport.dll