在特定条件下使用正则表达式查找空间

时间:2017-07-07 23:03:23

标签: regex

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Person",
  "name": "long distance movers quote",
  "url": "http://www.longdistancemoversquote.com",
  "sameAs": 
    "https://www.facebook.com/richard.russ.50"},
	</script>
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Person",
  "name": "long distance movers quote",
  "url": "http://www.longdistancemoversquote.com",
  "sameAs": 
    "https://www.facebook.com/longdistancemoversquote/"},
	</script>
<script type="application/ld+json">
{
  "@context":"http://schema.org",
  "@type":"ItemList",
  "itemListElement":[
    {
      "@type":"ListItem",
      "position":1,
      "url":"http://longdistancemoversquote.com/wp-content/uploads/2017/06/packinghelp.jpg"
    },
    {
      "@type":"ListItem",
      "position":2,
      "url":"http://longdistancemoversquote.com/wp-content/uploads/2017/06/localmovers.jpg"
    },
    {
      "@type":"ListItem",
      "position":3,
      "url":"http://longdistancemoversquote.com/wp-content/uploads/2017/06/moving-truck.png"
    }
  ]
}
</script> 
<script type="application/ld+json">
{
		"@context": "http://schema.org/",
        "@type": "Blog",
        "about": "A Blog about how too be prepared when your about to move. We will help you hire professional movers. Read our blog and tell us about your move and get a free moving quote!",
        "headline": "Free Moving Quote From Profressional Movers",
        "keywords": "Moving Quote, Local Movers Quote, Tips for Long Distance Moving, Long Distance Movers Quote",
        "url": "http://longdistancemoversquote.com/blog/"},
                </script>
<script type="application/ld+json">{
		"@context": "http://schema.org/",
        "@type": "Action",
        "description": "Get a free moving quote from local moving helpers to help you load and unload a truck or too help you pack and unpack your boxes",
        "image": "http://longdistancemoversquote.com/wp-content/uploads/2017/06/packinghelp.jpg",
        "url": "http://longdistancemoversquote.com/packing-loading-unloading-helpers/"},
</script>
<script type="application/ld+json">{
		"@context": "http://schema.org/",
        "@type": "Action",
        "description": "Get a free moving quote from local movers!",
        "image": "http://longdistancemoversquote.com/wp-content/uploads/2017/06/localmovers.jpg",
        "url": "http://longdistancemoversquote.com/free-local-movers-quote/"},
</script>
<script type="application/ld+json">{
		"@context": "http://schema.org/",
        "@type": "Action",
        "description": "Get a free moving quote from local and long distance movers!",
        "image": "http://longdistancemoversquote.com/wp-content/uploads/2017/06/cropped-movers-1.jpg",
        "url": "http://www.longdistancemoversquote.com"},
</script>
<script type="application/ld+json">{
	"@context": "http://schema.org/",
    "@type": "Product",
    "name": "Moving Quote",
    "category": "Local and Long Distance Movers",
    "description": "Moving quote, Local movers quote, long distance movers quote",
	"url": "http://www.longdistancemoversquote.com"},
        
</script>
<script type="application/ld+json">{
		"@context": "http://schema.org/",
        "@type": "Organization",
        "address": "2122 w butler Dr Phoenix, AZ 85021",
        "founder": "Richard Russ",
        "email": "richruss05@yahoo.com",
		"url": "https://www.facebook.com/longdistancemoversquote/",
		"url": "http://longdistancemoversquote.com/"},
        
</script>
<script type="application/ld+json">{
		"@context": "http://schema.org/",
         "@type": "Thing",
		"image": "http://longdistancemoversquote.com/wp-content/uploads/2017/06/packinghelp.jpg",
        "description": "image with a link to local movers quote",
        "disambiguatingDescription": "help for packing and unpacking loading and unloading helpers",
        "url": "http://longdistancemoversquote.com/packing-loading-unloading-helpers/",
        "name":"Packing Help"},
</script>
<script type="application/ld+json">{
	"@context": "http://schema.org/",
    "@type": "Thing",
    "Name": "Local Movers Quote",
    "description": "Get a quote from professional movers. Do you need help moving soon? Do you need to hite local movers?",
    "sameas": "http://longdistancemoversquote.com/free-local-movers-quote/",
    "url": "http://longdistancemoversquote.com/free-local-movers-quote/"},      
}
</script>
<script type="application/ld+json">
	{
    "@context": "http://schema.org/",
    "@type": "CreativeWork",
    "name": "Long Distance Moving quote",
    "about": "Get a free long distance moving quote. Getting a moving quote by professional movers for both local and long distance moves. Need help packing? WE CAN HELP"},
    }
    </script>
<script type="application/ld+json">
     {
      "@context": "http://schema.org/",
      "@type": "Website",
      "about": "Free Moving Quote - Free Long Distance Movers Quote",
      "name": "moving quote",
      "url": "http://www.longdistancemoversquote.com",
      "@type": "Website",
      "name": "long distance movers quote",
	"url": "http://longdistancemoversquote.com/long-distance-movers-quote/"},
	{
     "datePublished": "2017-06-20",
     "description": "Moving quote local long distance movers quote moving help local movers quote long distance movers quote"},
   </script>  

我想在这些词之间找到空格:

我可以找到这样的文字:

ERY Som

但是我如何选择空间,所以我用\ n?

替换它

谢谢!

1 个答案:

答案 0 :(得分:1)

您没有选择要替换的部件,而是选择要保留的部件。然后将它们复制到结果中,并将替换空间放在其位置。

Match: ([A-Z]{3})\s([A-Z]{1}[a-z]{2})
Replace: $1\n$2