Replace phrases with a single word

"for" or "and" or "nor" or "but" or "or" or "yet" or "so"

is just "for" since a non-empty string is Truthy in Python and or is evaluated lazily.

You can check in Python console :

>>> "for" or "and" or "nor" or "but" or "or" or "yet" or "so"
'for'

Here’s a possible way to solve your problem :

import re

def find_speech_part(matchobj):
  word = matchobj.group(0)
  if word.lower() in ["for","and","nor","but","or","yet","so"]:
    return "coordinating conjunction"
  else:
    return word

print(re.sub('w+', find_speech_part, 'For A but not for B because neither C nor D'))
# coordinating conjunction A coordinating conjunction not coordinating conjunction B because neither C coordinating conjunction D

It’s been adapted from this previous answer.

If a lunchbox contains an apple, then the apple is contained in a lunchbox. Is it possible to replace the phrase ‘is contained in’ with a single word? I can’t think of one, and the thesaurus hasn’t been very helpful, either.

RegDwigнt's user avatar

RegDwigнt

96.4k39 gold badges305 silver badges399 bronze badges

asked Jun 17, 2013 at 13:48

goblin GONE's user avatar

3

Try occupy, meaning to fill or take up (a space or time).

«The apple occupies the lunchbox.»
«The sofa occupies the entire room.»

There don’t appear to be too many single words meeting your requirement. If you were referring to an animal rather than an apple, you could use inhabit.

answered Jun 17, 2013 at 14:16

Canis Lupus's user avatar

Canis LupusCanis Lupus

21.9k2 gold badges38 silver badges77 bronze badges

2

Is in, is within, or is inside typically can substitute for is contained in. Eg, “The apple is inside the lunchbox.” Making lunchbox the subject of course gives you a short sentence that includes contain: “The lunch box contains an apple.”

answered Jun 17, 2013 at 16:06

James Waldby - jwpat7's user avatar

The best I can come up with is inhabit. According to Dictionary.com, it is used of things that are capable of locomotion or of abstract things, so it will seem a little ridiculous in this context. Occupy is another word, but the best thing to do by far is just to say «is contained in» or «is in», as Kian has suggested.

answered Jun 17, 2013 at 14:20

Kaiser Octavius's user avatar

Kaiser OctaviusKaiser Octavius

9721 gold badge13 silver badges24 bronze badges

The apple held in the lunch box.

answered Jun 17, 2013 at 20:31

Mari-Lou A's user avatar

Mari-Lou AMari-Lou A

88.1k86 gold badges303 silver badges571 bronze badges

3

The lunch box includes an apple.

answered Jun 17, 2013 at 15:50

Wayfaring Stranger's user avatar

3

Find and replace text

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

  1. Go to Home > Replace.

  2. Enter the word or phrase you want to replace in Find what.

  3. Enter your new text in Replace with.

  4. Choose Replace All to change all occurrences of the word or phrase. Or, select Find Next until you find the one you want to update, and then choose Replace.

  5. To specify only upper or lowercase in your search, select More > Match case. There are several other ways to search in this menu.

Match case

For other options, see Find and replace text

Find and replace basic text

In the upper-right corner of the document, in the search box Enter text to search for in the document, type the word or phrase that you want to find, and Word will highlight all instances of the word or phrase throughout the document.

To replace found text:

  1. Select the magnifying glass, and then select Replace.

    The Replace option is highlighted in the Search box

  2. In the Replace With box, type the replacement text.

  3. Select Replace All or Replace.

    Tips: 

    • You can also open the basic Find and Replace pane with the keyboard shortcut CONTROL + H.

    • When you replace text, it’s a good idea to select Replace instead of Replace All. That way you can review each item before replacing it.

You can find text with special formatting, such as bold or highlight, by using the Format menu.

  1. Select View > Navigation Pane.

    On the View tab, Navigation Pane is checked

  2. In the Navigation Pane, select the magnifying glass.

  3. Select Settings Screenshot of gear, and then select Advanced Find & Replace.

    In the Find and Replace box, Advanced Find and Replace is highlighted

    Notes: 

    • Select the arrow at the bottom of the Find and Replace dialog box to show all options.

    • Shows how to open the Format popup menu

  4. On the Format menu, select the option that you want.

    Shows the Format options

    If a second dialog box opens, select the options that you want, and then select OK.

  5. In the Find and Replace dialog box, select Find Next or Find All.

You can find and replace text with special formatting, such as bold or highlight, by using the Format menu.

  1. Select View > Navigation Pane.

    On the View tab, Navigation Pane is checked

  2. In the Navigation Pane, select the magnifying glass.

  3. Select Settings Screenshot of gear, and then select Advanced Find & Replace.

    In the Find and Replace box, Advanced Find and Replace is highlighted

  4. At the top of the dialog box, select Replace.

    Notes: 

    • Select the arrow at the bottom of the Find and Replace dialog box to show all options.

    • Shows how to open the Format popup menu

  5. On the Find what box, type the text that you want to find.

  6. On the Format menu, select the formatting that you want to find.

    Shows the Format options

    If a second dialog box opens, select the options that you want, and then select OK.

  7. Select in the box next to Replace with.

  8. On the Format menu, select the replacement formatting. If a second dialog box appears, select the formats that you want, and then select OK.

  9. Select Replace, Replace All, or Find Next.

  1. Select View > Navigation Pane.

  2. In the Navigation Pane, select the magnifying glass.

  3. Select Settings Screenshot of gear, and then select Advanced Find & Replace.

    In the Find and Replace box, Advanced Find and Replace is highlighted

    Notes: 

    • Select the arrow at the bottom of the Find and Replace dialog box to show all options.

    • Shows how to open the Format popup menu

  4. On the Special menu, select the special character that you want to find.

    Find special characters

  5. Select Find Next.

  1. Select View > Navigation Pane.

    On the View tab, Navigation Pane is checked

  2. In the Navigation Pane, select the magnifying glass.

  3. Select Settings Screenshot of gear, and then select Advanced Find & Replace.

    In the Find and Replace box, Advanced Find and Replace is highlighted

    Notes: 

    • Select the arrow at the bottom of the Find and Replace dialog box to show all options.

    • Shows how to open the Format popup menu

  4. At the top of the Find and Replace dialog box, select Replace and then select in the Find What box, but don’t type anything there. Later, when you select a special character, Word will automatically put the character code in the box for you.

    Note: Select the arrow at the bottom of the Find and Replace dialog box to show all options.
    Shows how to open the Format popup menu

  5. On the Special menu, select the special character that you want to find.

  6. Select in the Replace with box.

  7. On the Special menu, select the special character that you want to use as a replacement.

  8. Select Replace or Find Next.

  1. Select View > Navigation Pane.

    On the View tab, Navigation Pane is checked

  2. In the Navigation Pane, select the magnifying glass.

  3. Select Settings Screenshot of gear, and then select Advanced Find & Replace.

    In the Find and Replace box, Advanced Find and Replace is highlighted

  4. Select the Use wildcards check box.

    If you don’t see the Use wildcards check box, select Down arrow for more options.

  5. Select the Special menu, select a wildcard character, and then type any additional text in the Find what box.

    Using wildcards in the Find and Replace dialog box

  6. Select Find Next.

    Tips: 

    • To cancel a search in progress, press The Command button.+ PERIOD.

    • You can also enter a wildcard character directly in the Find what box instead of selecting an item from the Special pop-up menu.

    • To search for a character that’s defined as a wildcard character, type a backslash () before the character. For example, type ? to find a question mark.

    • You can use parentheses to group the wildcard characters and text and to indicate the order of evaluation. For example, search for <(pre)*(ed)> to find «presorted» and «prevented.»

    • You can search for an expression and use the n wildcard character to replace the search string with the rearranged expression. For example, type (Newman) (Belinda) in the Find what box and 2 1 in the Replace with box. Word will find «Newman Belinda» and replace it with «Belinda Newman.»

  7. To replace found text:

    1. Select the Replace tab, and then select the Replace with box.

    2. Select Special, select a wildcard character, and then type any additional text in the Replace with box.

    3. Select Replace All, Replace, or Find Next.

      Tip: When you replace text, it’s a good idea to select Replace instead of Replace All. That way you can confirm each replacement to make sure that it’s correct.

You can refine a search by using any of the following wildcard characters.

To find

Use this

For example

Any single character

?

s?t finds «sat» and «set.»

Any string of characters

*

s*d finds «sad» and «started.»

One of the specified characters

[ ]

w[io]n finds «win» and «won.»

Any single character in this range

[-]

[r-t]ight finds «right» and «sight» and «tight.»

Ranges must be in ascending order.

Any single character except the characters inside the brackets

[!]

m[!a]st finds «mist» and «most» but not «mast.»

Any single character except characters in the range inside the brackets

[!x-z]

t[!a-m]ck finds «tock» and «tuck» but not «tack» or «tick.»

Ranges must be in ascending order.

Exactly n occurrences of a character or expression

{ n}

fe{2}d finds «feed» but not «fed.»

At least n occurrences of a character or expression

{ n,}

fe{1,}d finds «fed» and «feed.»

A range of occurrences of a character or expression

{ n, n}

10{1,3} finds «10,» «100,» and «1000.»

One or more occurrences of a character or expression

@

lo@t finds «lot» and «loot.»

The beginning of a word

<

<(inter) finds «interesting» and «intercept» but not «splintered.»

The end of a word

>

(in)> finds «in» and «within,» but not «interesting.»

Word for the web lets you find and replace basic text. You can match case or fine whole words only. For more varied options, open your document in Word for the desktop.

Need more help?

100

The dog uneven walk show a

What is a limp?

100

I opened my arms and help my cousin

What is an embrace?

100

Not very deep

What is shallow?

100

Hard to follow

What is confuse?

200

To be eager

What is a keen?

200

A very short period

What is instant?

200

Gather around

What is surround?

200

A person who is hurt

What is a victim?

300

Provide what is needed is

What is equip?

300

Change in form

What is Flexible?

300

To force or throw out

What is eject?

300

Given out

What is Distribute?

400

Ran with quick little steps

What is Scurry?

400

To change something is

What is alter?

400

The government take all assets

What is seized?

400

Having a sharp edge

What is keen?

500

To grab hold of

What is seize?

500

Thrown with great force

What is Eject?

500

Agreeable to any sudden change of plan

What is flexible?

500

A state of mixed up

What is confusion?

Click to zoom

Each sentence given below has an underlined part. Replace that underlined part with a word that expresses the same idea and rewrite the sentence.

1. Even after the teacher entered the classroom, the boys went on playing.

2. He is in debt because of his habit of spending money wastefully.

3. The celebrations went on for a whole month.

4. His uncle is a famous designer of buildings.

5. The drunkard abused people without discrimination.

6. He spent most of his life abroad as one sent out of his country.

7. The country is passing through a critical phase.

8. Bacon’s essays are full of terse, witty, pointed statements.

9. If you lose your good name, it is not easy to get it back.

10. There was no famine in our country during the last twenty years.

11. The Mona Lisa is the best among the works of Leonardo da Vinci.

12. My friend had the special right or advantage of visiting England as the official guest of the Queen.

Answers

1. Even after the teacher entered the classroom, the boys continued playing.

2. He is in debt because of his extravagance.

3. The celebrations lasted / continued for a whole month.

4. His uncle is a famous architect.

5. The drunkard abused people indiscriminately.

6. He spent most of his life abroad as an exile.

7. The country is passing through a crisis.

8. Bacon’s essays are full of epigrams.

9. If you lose your reputation, it is not easy to get it back.

10. There was no famine in our country during the last two decades.

11. The Mona Lisa is the masterpiece of Leonardo da Vinci.

12. My friend had the privilege of visiting England as the official guest of the Queen.

Like this post? Please share to your friends:
  • Replace words in word vba
  • Replace option in word
  • Replace words and word combinations
  • Replace one word with another in word
  • Replace word with sed