Double every word that contains a substring (lets say "done") but not the substring itself

regex match string containing word
how to check if string has all same characters
check if string contains all characters of another string
regex does not contain multiple words
java check if string contains characters
check if string has substring
return whether a string consists of a single letter
how to check if a string contains multiple characters in java
Example:
I have done my job well. i donett need any advice.
I have done my job well. I donett donett need any advice.

This is the code that i tried:

$ cat * | sed -E 's/\w*+done\w+*/& &/g'|  grep 'done'

But this code counts done as an end result as well. I need to do it using sed.

This could be easily done with awk in case you are ok with it.

awk '{for(i=1;i<=NF;i++){if($i !~ /^done$/ && $i ~ /done/){$i=$i OFS $i}}} 1' Input_file

Output will be as follows.

I have done my job well. I donett donett need any advice.

Foundation ActionScript 3, String.indexOf() returns the first position of a character or substring within a string. Now, let's say you wanted to see whether this string contained the word pick. it's searching for any consecutive sequence of characters containing the letters p, tongueTwister variable contains this sequence of characters (twice, in fact),  contains will search a substring throughout the entire String and will return true if it's found and false otherwise. In this example, contains returns true because “Hey” is found. Assert.assertTrue("Hey Ho, let's go".contains("Hey"));

Or a sed-solution you asked for:

echo 'I have done my job well. i donett need any advice.' | sed -r 's/(\Wdone\w+|\w+done\w+|\w+done\W)/\1 \1/g; s/  / /g'
I have done my job well. i donett donett need any advice.

How do I check if a String contains the same letter more than once , Let's say I only want to print out any words which contain more than one "z", therefore only "buzzer" and "zappaz" would get printed. How would I  The substring begins at the specified beginIndex and extends to the character at index endIndex – 1. Thus the length of the substring is endIndex-beginIndex. In other words you can say that beginIndex is inclusive and endIndex is exclusive while getting the substring. For example – "Chaitanya".substring(2,5) would return "ait".

I would suggest using two expressions and combining them with |

$ cat * | sed -E 's/\w+done\w*|\w*done\w+/& &/g'
I have done my job well. I donett donett need any advice.

Learning GNU Emacs, The initial s in each means that a string is expected; the $s is a formatting operator (as in the Getting back to our count-words-buffer command: it has no arguments, so its interactive Remember that any double quotes inside a string need to be preceded by backslashes. (interactive) (save-excursion (let ( (count 0).)  With any database, the CONTAINS SQL function for SQL Server checks if one string contains a second string as a substring. For Microsoft SQL Server and similar systems, CONTAINS lets you do full-text term pattern-matching queries on your tables.

Ubuntu Unleashed 2015 Edition: Covering 14. 10 And 15. 04, Often an address has long substrings of all zeros; the longest and first run of all zero sections is abbreviated as a double colon (“ ::”). Because :: is Let's say you want to break your corporate network into 64 subnets. Some IPv6 masking tools work with just this one hex word; otherwise, a full 128-bit hex mask would be  Java > String-1 > startWord (CodingBat Solution) Problem: Given a string and a second "word" string, we'll say that the word matches the string if it appears at the front of the string, except its first char does not need to match exactly.

Regex to Test The Same Part of The String for More Than One , Let's say we want to find a word that is six letters long and contains the three if you want to find any word between 6 and 12 letters long containing either “cat”, “​dog” or “mouse”. Our double-requirement-regex has matched successfully. In the comments of our Word Fact post about the difference between affect and effect, Carolyn K. wrote: Please, please, please, I beg you to do Lets vs. Let’s. Every sports team’s media/PR department does it wrong, and it drives me absolutely out of my mind! This lets us address another great topic, since these terms are often confused—let’s figure it out! Lets without an …

Regex match single quoted string, Let's say you want to find double-quoted strings. Progressively match the whole string, capturing word groups in Group 1 and 'AND' in Group 2, This regex matches any numeric substring (of digits 0 to 9) of the input. A string can contain ASCII, UNICODE and ICU's Regular Expressions package provides  Given a string and a non-empty word string, return a string made of each char just before and just after every appearance of the word in the string. Ignore cases where there is no char before or after the word, and a char may be included twice if it is between two words. wordEnds("abcXY123XYijk", "XY") → "c13i" wordEnds("XY123XY", "XY") → "13"

Comments
  • sed 's/\<done\w\+/& &/g' *