Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I want to match standard email syntax (lowercased English, numbers and perhaps also some hyphens and underscores) with regex for a sed operation that matches and changes a single email address insi...
#5: Post edited
- I want to match standard email syntax (lowercased English, numbers and perhaps also some hyphens and underscores) with regex for a `sed` operation that matches and changes a single email address inside a file.
- The following code failed:
- read new_email_address
sed -i 's/^[a-zA-Z0-9-_]*$@^[a-zA-Z0-9-_]*$.^[a-z]*$/"${new_email_address}"/g' FILE- I know its problematic in the sense that files can have two or more email addresses and a global change is dangerous, but this is primarily just for learning and practice regex and `sed`.
- I want to match standard email syntax (lowercased English, numbers and perhaps also some hyphens and underscores) with regex for a `sed` operation that matches and changes a single email address inside a file.
- The following code failed:
- read new_email_address
- sed -i 's/[a-zA-Z0-9-_]*@[a-zA-Z0-9-_]*.[a-z]*/"'"${new_email_address}"'"/g' FILE
- I know its problematic in the sense that files can have two or more email addresses and a global change is dangerous, but this is primarily just for learning and practice regex and `sed`.
#4: Post edited
- I want to match standard email syntax (lowercased English, numbers and perhaps also some hyphens and underscores) with regex for a `sed` operation that matches and changes a single email address inside a file.
- The following code failed:
- read new_email_address
- sed -i 's/^[a-zA-Z0-9-_]*$@^[a-zA-Z0-9-_]*$.^[a-z]*$/"${new_email_address}"/g' FILE
I now its problematic in the sense that files can have two or more email addresses and a global change is dangerous, but this is primarily just for learning and practice regex and `sed`.
- I want to match standard email syntax (lowercased English, numbers and perhaps also some hyphens and underscores) with regex for a `sed` operation that matches and changes a single email address inside a file.
- The following code failed:
- read new_email_address
- sed -i 's/^[a-zA-Z0-9-_]*$@^[a-zA-Z0-9-_]*$.^[a-z]*$/"${new_email_address}"/g' FILE
- I know its problematic in the sense that files can have two or more email addresses and a global change is dangerous, but this is primarily just for learning and practice regex and `sed`.
#3: Post edited
- I want to match standard email syntax (lowercased English, numbers and perhaps also some hyphens and underscores) with regex for a `sed` operation that matches and changes a single email address inside a file.
- The following code failed:
- read new_email_address
- sed -i 's/^[a-zA-Z0-9-_]*$@^[a-zA-Z0-9-_]*$.^[a-z]*$/"${new_email_address}"/g' FILE
I now its problematic in the sense that files can have two or more email addresses and a global change is dangerous, but this is primarily just for learning and practice.
- I want to match standard email syntax (lowercased English, numbers and perhaps also some hyphens and underscores) with regex for a `sed` operation that matches and changes a single email address inside a file.
- The following code failed:
- read new_email_address
- sed -i 's/^[a-zA-Z0-9-_]*$@^[a-zA-Z0-9-_]*$.^[a-z]*$/"${new_email_address}"/g' FILE
- I now its problematic in the sense that files can have two or more email addresses and a global change is dangerous, but this is primarily just for learning and practice regex and `sed`.
#2: Post edited
- I want to match standard email syntax (lowercased English, numbers and perhaps also some hyphens and underscores) with regex for a `sed` operation that matches and changes a single email address inside a file.
- The following code failed:
- read new_email_address
sed -i 's/^[a-zA-Z0-9-_]*$@^[a-zA-Z0-9-_]*$.^[a-z]*$/"${new_email_address}"/g' FILE
- I want to match standard email syntax (lowercased English, numbers and perhaps also some hyphens and underscores) with regex for a `sed` operation that matches and changes a single email address inside a file.
- The following code failed:
- read new_email_address
- sed -i 's/^[a-zA-Z0-9-_]*$@^[a-zA-Z0-9-_]*$.^[a-z]*$/"${new_email_address}"/g' FILE
- I now its problematic in the sense that files can have two or more email addresses and a global change is dangerous, but this is primarily just for learning and practice.
#1: Initial revision
How to match standard email addresses with regex?
I want to match standard email syntax (lowercased English, numbers and perhaps also some hyphens and underscores) with regex for a `sed` operation that matches and changes a single email address inside a file. The following code failed: read new_email_address sed -i 's/^[a-zA-Z0-9-_]*$@^[a-zA-Z0-9-_]*$.^[a-z]*$/"${new_email_address}"/g' FILE