How to extract text with a certain condition with notepad?
-
Hello, I tried to extract and paste in another file a text that has the characters @ @ but I have not succeeded
tengo el texto
y@17text@mail.com:telephone1
y17text@mail.com:telephone12
y19@text@mail.com:telephone15
@y31text@mail.com:telephone1345
y1wtext@mail.com:telephone1789
@y15text@mail.com:telephone14567
y18text@mail.com:telephone12345I need to extract those that have two or more @ paste them into another file
y@17text@mail.com:telephone1
y19@text@mail.com:telephone15
@y31text@mail.com:telephone1345
@y15text@mail.com:telephone14567 -
Try this:
Invoke Mark dialog (Search (menu) -> Mark…)
Find what zone:(?-s)^.*?@.*?@.+
Mark line checkbox: ticked
Wrap around checkbox: ticked
In selection checkbox: unticked
Search mode selection: Regular expression
Action: Press Find All button
Next action: Search (menu) -> Bookmark -> Copy Bookmarked Lines
Next action: Paste wherever suits youHere’s how the regular expression part of it works:
(?-s)^.*?@.*?@.+- [Assert position at the beginning of a line (at beginning of the string or after a line break character) (carriage return and line feed, form feed)][1 ]
^ - [Match any single character that is NOT a line break character (line feed, carriage return, form feed)][2 ]
.*?- [Between zero and unlimited times, as few times as possible, expanding as needed (lazy)][3 ]
*?
- [Between zero and unlimited times, as few times as possible, expanding as needed (lazy)][3 ]
- [Match the character “@” literally][4 ]
@ - [Match any single character that is NOT a line break character (line feed, carriage return, form feed)][2 ]
.*?- [Between zero and unlimited times, as few times as possible, expanding as needed (lazy)][3 ]
*?
- [Between zero and unlimited times, as few times as possible, expanding as needed (lazy)][3 ]
- [Match the character “@” literally][4 ]
@ - [Match any single character that is NOT a line break character (line feed, carriage return, form feed)][2 ]
.+- [Between one and unlimited times, as many times as possible, giving back as needed (greedy)][5 ]
+
- [Between one and unlimited times, as many times as possible, giving back as needed (greedy)][5 ]
Created with RegexBuddy
[1 ]: http://www.regular-expressions.info/anchors.html
[2 ]: http://www.regular-expressions.info/dot.html
[3 ]: http://www.regular-expressions.info/repeat.html#lazy
[4 ]: http://www.regular-expressions.info/characters.html
[5 ]: http://www.regular-expressions.info/repeat.html - [Assert position at the beginning of a line (at beginning of the string or after a line break character) (carriage return and line feed, form feed)][1 ]
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login