小编San*_*ani的帖子

正则表达式用'||'''替换'(单引号一次但不是''(单引号两次)

在下面的行中,如果我们有单引号(')那么我们必须用'||'''替换它,但如果我们有两次单引号('')那么它应该是原样.

我尝试下面的一段代码没有给我正确的输出.

代码片段:

static String replaceSingleQuoteOnly = "('(?!')'{0})";
String line2 = "Your Form xyz doesn't show the same child''s name as the name in your account with us.";
System.out.println(line2.replaceAll(replaceSingleQuoteOnly, "'||'''"));
Run Code Online (Sandbox Code Playgroud)

上述代码的实际输出:

Your Form xyz doesn'||'''t show the same child''||'''s name as the name in your account with us.
Run Code Online (Sandbox Code Playgroud)

预期结果:

Your Form xyz doesn'||'''t show the same child''s name as the name in your account with us.
Run Code Online (Sandbox Code Playgroud)

正则表达式替换子"是孩子""||"'的.孩子 应该保持原样.

java regex

5
推荐指数
2
解决办法
377
查看次数

SOLRJ-6.0.0:插入一个bean对象,该对象关联bean对象列表,给出空指针异常

员工Bean类:

public class Employee2 {

    private String id;
    private String name;
    private String designation;
    private double salary;
    private double totalExperience;
//    private Address2 address2;
    private Collection<Technology2> technologies2;
    private String content_type = "employee2";

    public Employee2() {
        super();
    }

    public Employee2(String id, String name, String designation, double salary, double totalExperience,
            Collection<Technology2> technologies2) {
        super();
        this.id = id;
        this.name = name;
        this.designation = designation;
        this.salary = salary;
        this.totalExperience = totalExperience;
//        this.address2 = address2;
        this.technologies2 = technologies2;
    }

    /**
     * @return the id …
Run Code Online (Sandbox Code Playgroud)

indexing solr nested nullpointerexception solrj

4
推荐指数
1
解决办法
1958
查看次数

标签 统计

indexing ×1

java ×1

nested ×1

nullpointerexception ×1

regex ×1

solr ×1

solrj ×1