Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10154
    thanksgod
    Participant

    I would like to ask about the Regular Expression please.

    FYI, I just started learning RegEX, so I’m really a noob about RegEx for now = =”

    My question is,

    for example, I would like to “replace” all the characters (words) when it finds the MATCHED “characters” or “words” in the following, but I don’t know what RegEx I should use

    363UUID:2126A5D926
    IKYUUID :FC1012AA09545
    KYDKYEUUID :2CC2F29D54D7849(&#

    I use
    Find “UUID:……….” <=== I use "." for ten times
    Replace “my words”

    However, It’s only replace like the following

    363my words
    IKYmy words545
    KYDKYEmy wordsD7849(&#

    But that’s not what I want
    because it’s only replace the ten “characters” only I want to replace all the “characters” which doesn’t matter how many left on that line,
    But I want to replace them all SINCE it finds the MATCHED “characters” or “words” and the result I want should be like the following.

    363my words
    IKYmy words
    KYDKYEmy words

    As you can see, It was my bad using “.” RegEx for “ten dots”, but I can use “twenty dots” in this case to make it works
    However, ASSUME I don’t know What is the Highest number of dots I should use as if there are thousand of lines,
    and each line doesn’t have the same number of characters.

    FYI, I can just use ………………………………… as much as I want, However, if in that documents only has “LESS” characters for each line than the “dots” RegEX I used,
    the program will do NOTHING, and give me “Error BEEP (sound)”

    So can you give me the Correct (EASY) RegEx I could use please

    Thank you so much if anyone can help me out for this.

    #10155
    thanksgod
    Participant

    Hi, this is another example,

    abc.com – Log in

    xyz.com – Log in

    Here I want the “RegEX” to replace those 2 lines or more lines and need the result like the following

    http://members.abc.com
    http://members.xyz.com

    As you can see that, I would like to remove OR replace all the characters & numbers & symbols that occur before http://, and remove OR replace all the characters & numbers & symbols that occur after .com

    what should I do?

    Thank you so much if anyone can help me out. !!!

    #10159
    ToadLoadin
    Member

    thanksgod wrote:
    I would like to ask about the Regular Expression please.

    Perhaps

    UUID:.+

    would work, “.+” means one or more characters, so it could match either 10 or 20 characters both. :-)

    #10160
    ToadLoadin
    Member

    thanksgod wrote:
    Hi, this is another example,

    For this situation, I guess sub-patterns with parentheses may help :-)

    Try replace

    ^.*(https?://members.(abc|xyz).com).*$

    with

    1
    #10183
    thanksgod
    Participant

    Hi, ToadLoadin

    All your solutions are really great, they work very well

    BTW, I have tried many examples and also try to play with more regular expression, and it really fun right now. However, if I stuck with something in the future about Regular Expression then I would need your help again >_< Thank you so much ToadLoadin :-D :-D :-D

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.