package tars.model.task;

import tars.commons.exceptions.IllegalValueException;

/**
 * Represents a Task's name in tars.
 * Guarantees: immutable; is valid as declared in {@link #isValidName(String)}
 */
public class Name {

    public static final String MESSAGE_NAME_CONSTRAINTS = "Task names should be spaces or alphanumeric characters";
    public static final String NAME_VALIDATION_REGEX = "[\\p{Alnum} ]+";

    public final String taskName;

    /**
     * Validates given task name.
     *
     * @throws IllegalValueException if given name string is invalid.
     */
    public Name(String name) throws IllegalValueException {
        assert name != null;
        name = name.trim();
        if (!isValidName(name)) {
            throw new IllegalValueException(MESSAGE_NAME_CONSTRAINTS);
        }
        this.taskName = name;
    }

    /**
     * Returns true if a given string is a valid task name.
     */
    public static boolean isValidName(String test) {
        return test.matches(NAME_VALIDATION_REGEX);
    }


    @Override
    public String toString() {
        return taskName;
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Name // instanceof handles nulls
                && this.taskName.equals(((Name) other).taskName)); // state check
    }

    @Override
    public int hashCode() {
        return taskName.hashCode();
    }

}

@@ -306,16 +306,33 @@
  spaces 
+%22%0A            + %22
 or alpha
@@ -349,16 +349,73 @@
 aracters
+ %22%0A            + %22or these special characters: !@#$%25%5E&*)(
 %22;%0A    p
@@ -469,22 +469,33 @@
  = %22
-%5B%5C%5Cp%7BAlnum%7D %5D+
+%5E%5Ba-zA-Z0-9 !@#$%25%5E&*)(%5D*$
 %22;%0A%0A

Update Name.java Allow task name to have these special characters: !@#$%^&*)(