Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 822361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:47:18+00:00 2026-05-15T02:47:18+00:00

I’m currently modifying my regex for this: Extracting email addresses in an html block

  • 0

I’m currently modifying my regex for this:

Extracting email addresses in an html block in ruby/rails

basically, im making another obfuscator that uses ROT13 by parsing a block of text for all links that contain a mailto referrer(using hpricot). One use case this doesn’t catch is that if the user just typed in an email address(without turning it into a link via tinymce)

So here’s the basic flow of my method:
1. parse a block of text for all tags with href=”mailto:…”
2. replace each tag with a javascript function that changes this into ROT13 (using this script: http://unixmonkey.net/?p=20)
3. once all links are obfuscated, pass the resulting block of text into another function that parses for all emails(this one has an email regex that reverses the email address and then adds a span to that email – to reverse it back)

step 3 is supposed to clean the block of text for remaining emails that AREN’T in a href tags(meaning it wasn’t parsed by hpricot). Problem with this is that the emails that were converted to ROT13 are still found by my regex. What i want to catch are just emails that WEREN’T CONVERTED to ROT13.

How do i do this? well all emails the WERE CONVERTED have a trailing “‘.replace” in them. meaning, i need to get all emails WITHOUT that string. so far i have this regex:

/\b([A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}(‘.replace))\b/i

but this gets all the emails with the trailing ‘.replace i want to get the opposite and I’m currently stumped with this. any help from regex gurus out there?

MORE INFO:

Here’s the regex + the block of text im parsing:

http://www.rubular.com/r/NqXIHrNqjI

as you can see, the first two ’email addresses’ are already obfuscated using ROT13. I need a regex that gets the emails ohhellzyeah@ribute.com and kaboom@yahoo.com

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:47:18+00:00Added an answer on May 15, 2026 at 2:47 am

    On negative lookaheads

    You can use a negative lookahead to assert that a pattern doesn’t match.

    For example, the following regex matches all strings that doesn’t end with ".replace" string:

    ^(?!.*\.replace$).*$
    

    As another example, this regex matches all a*b*, except aabb:

    ^(?!aabb$)a*b*$
    

    Ideally,

    See also

    • regular-expressions.info/Lookaheads and anchors
      • Flavor comparison – unfortunately, Ruby doesn’t support lookbehinds

    Specific solution

    The following regex works in this scenario: (see on rubular.com):

    /\b([A-Z0-9._%+-]+@(?![A-Z0-9.-]*'\.replace\b)[A-Z0-9.-]+\.[A-Z]{2,4})\b/i
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.