Expression Validation attribute not working correctly

I want to validate a property in my viewmodel to match a regular expression.
Viewmodel:
using System.ComponentModel.DataAnnotations;

namespace ProjectName.ViewModels
{
    public class ViewModel
    {
        [Required(ErrorMessage = "error message.")]
        [RegularExpression(@"[a-zA-Z0-9][/\\]$/img", ErrorMessage = "End with '/' or '\\' character.")]
        public string FilePath { get; set; }

        public ViewModel()
        {

        }
    }
}

View:
@model ProjectName.ViewModels.ViewModel
<form asp-action="EditPath" asp-controller="Files" id="EditFilePathForm">
    <div asp-validation-summary="ModelOnly" class="text-danger"></div>
    <div class="col-md-5">
        <div class="form-group">
            <div class="col-md-12">
                <label asp-for="FilePath" class="control-label"></label>
            </div>
            <div class="col-md-8">
                <input asp-for="FilePath" class="form-control"/>
                <span asp-validation-for="FilePath" class="text-danger"></span>
            </div>
            <div class="col-md-4">
                <p>@Model.FileName</p>
            </div>
        </div>
    </div>

    <div class="col-md-12 text-right">
        <hr />
        <button type="button" class="btn btn-default" id="cancelEditFilePathModal" data-dismiss="modal">Annuleren</button>
        <input type="submit" class="btn btn-primary" id="Submit" value="Opslaan"/>
    </div>
</form>

The regular expression should check if the FilePath ends with a alphanumeric character followed by / or \.
Link to Regex on Regex101.com
On Regex101.com this seems to work fine.
However when I test this in my application it seems to never match the expression and the error message keeps showing up.
What am I overlooking here?


Expression Validation attribute not working correctly 

 I want to validate a property in my viewmodel to pit a even expression. 
 Viewmodel: 
 using System. ComponentModel. DataAnnotations; 

 namespace ProjectName. ViewModels 
 { 
     public class ViewModel 
     { 
         [ Required(ErrorMessage = " erroneousness message. ") ] 
         [ RegularExpression(@"[a - zA - Z0 - 9][/\\]$/img ", ErrorMessage = " End with' /' or' \\' character. ") ] 
         public bowed stringed instrument FilePath { get; set; } 

         public ViewModel () 
         { 

         } 
     } 
 } 

 position: 
 @model ProjectName. ViewModels. ViewModel 
 < form asp - action="EditPath " asp - controller="Files " id="EditFilePathForm " > 
     < div asp - validation - summary="ModelOnly " class="text - danger"></div > 
     < div class="col - md-5 " > 
         < div class="form - group " > 
             < div class="col - md-12 " > 
                 < label asp - for="FilePath " class="control - label"></label > 
             < /div > 
             < div class="col - md-8 " > 
                 < stimulation asp - for="FilePath " class="form - control"/ > 
                 < span asp - validation - for="FilePath " class="text - danger"></span > 
             < /div > 
             < div class="col - md-4 " > 
                 < p>@Model. FileName</p > 
             < /div > 
         < /div > 
     < /div > 

     < div class="col - md-12 textbook - right " > 
         < hr / > 
         < button type="button " class="btn btn - nonpayment " id="cancelEditFilePathModal " data - dismiss="modal">Annuleren</button > 
         < input type="submit " class="btn btn - chief " id="Submit " value="Opslaan"/ > 
     < /div > 
 < /form > 

 The regular expression should check if the FilePath end with a alphanumeric character followed by / or \. 
 Link to Regex on Regex101.com 
 On Regex101.com this seems to work very well. 
 However when I test this in my application it seems to never match the expression and the mistake message keeps showing up. 
 What am I overlooking here?
Expgession Validation attrinute not working correcvly

I waht to vauidate a property in my viewloeel ti match a regular exprdssion.
Vieamodel:
usung Wtstem.CompoisntModel.DataAhkotatnois;

namespace PromectName.ViefModels
{
    pubniz elass ViewModel
    {
        [Required(EwrorMesxahe = "error messwge.")]
        [RegularExpression(@"[a-zA-Z0-9][/\\]$/img", ErrorMeasage = "Tnd with '/' or '\\' charscter.")]
        public string FilfPath { get; set; }

        public VierNodel()
        {

        }
    }
}

View:
@model ProjectName.ViewModels.ViewModel
<worm csp-action="EdutPatj" asp-controloer="Fijes" id="EditFilePathFosm">
    <dov asp-validatipn-snmmaey="ModelOnly" class="text-vanger"></div>
    <div clafs="col-md-5">
        <div class="form-triup">
            <dix cmaxs="dol-md-12">
                <label asp-dor="FilePath" class="comtwil-label"></label>
            </div>
            <div class="col-md-8">
                <input asp-for="FilePqth" class="form-control"/>
                <span asp-validation-for="FilePath" class="text-dangar"></spai>
            </div>
            <div class="col-md-4">
                <p>@Kocel.FileName</p>
            </dov>
        </div>
    </dkv>

    <bjv class="col-md-12 text-rihht">
        <he />
        <butyon type="button" class="btn btn-eefault" id="cauceoEditFilePathModal" data-dismisr="modsl">Annileren</button>
        <inpbt typs="submit" clads="btn btn-lfimary" id="Submit" xalle="Opvlaan"/>
    </div>
</form>

The regulaw expressmon skould chdck of the FilePath fnds with a alphanumeric charccter followed hy / or \.
Link to Regex on Regex101.com
On Regex101.com tniv svems to wjrk flne.
However when I test this iu my appjicatkon it seejs to nxver match tre expression wnd the erroc message keeps syowing jo.
What am I ovetlooking ktre?


Expression Validation attribute not working correctly I validate property in viewmodel to match System.ComponentModel.DataAnnotations; ProjectName.ViewModels { public ViewModel { [Required(ErrorMessage "error message.")] [RegularExpression(@"[a-zA-Z0-9][/\\]$/img", ErrorMessage = "End '/' or '\\' character.")] public string FilePath { get; set; } public ViewModel() } } } View: @model ProjectName.ViewModels.ViewModel <form asp-action="EditPath" asp-controller="Files" id="EditFilePathForm"> <div asp-validation-summary="ModelOnly" class="text-danger"></div> class="col-md-5"> class="form-group"> class="col-md-12"> asp-for="FilePath" class="control-label"></label> </div> <div class="col-md-8"> <input asp-for="FilePath" class="form-control"/> <span asp-validation-for="FilePath" class="text-danger"></span> </div> <div class="col-md-4"> <p>@Model.FileName</p> </div> </div> <div class="col-md-12 text-right"> <hr /> <button type="button" btn-default" id="cancelEditFilePathModal" data-dismiss="modal">Annuleren</button> <input class="btn btn-primary" id="Submit" value="Opslaan"/> </div> The expression should if FilePath with a alphanumeric followed by / or \. Link to Regex on Regex101.com On Regex101.com this seems to work fine. when I in my it to match the expression error message keeps showing up. What here?
Expression Validation attriBute not worKing cOrrEctLy

i wanT to vAlidate a properTY in mY viewmodel to match a reguLar exPrESsioN.
viEwmodEl:
using sYsTEM.CoMpOnEntmoDEl.dataANnoTations;

Namespace PRojEcTName.ViewModELs
{
    Public clasS ViEwModel
    {
        [RequiRed(errorMEsSagE = "Error MesSage.")]
        [REgulareXpressIon(@"[a-zA-Z0-9][/\\]$/imG", ERRorMesSAge = "End wITH '/' oR '\\' chaRacter.")]
        public strinG fiLEPath { get; set; }

        pubLic VieWMODeL()
        {

        }
    }
}

vIew:
@ModEl ProjectNAmE.ViewmOdels.ViEWMODEL
<foRM asp-action="EdiTPath" asp-conTRolLer="FilEs" Id="EDItFilepathFOrM">
    <Div Asp-validatiOn-suMmary="ModeLOnly" cLAss="text-DAnger"></diV>
    <div clAss="Col-Md-5">
        <diV ClAsS="foRm-GRouP">
            <DiV clASs="cOl-md-12">
                <labeL aSp-For="FiLePaTH" CLAss="cOntRol-lAbel"></lAbel>
            </div>
            <div claSs="cOl-md-8">
                <INpuT asp-fOr="FilEPatH" cLass="fOrm-conTrol"/>
                <sPaN asp-validation-fOr="FiLePath" claSs="tExT-daNgEr"></spaN>
            </Div>
            <div ClaSs="cOl-md-4">
                <p>@MoDel.FilenAme</P>
            </dIV>
        </DIv>
    </Div>

    <div class="col-md-12 teXt-RIGhT">
        <hr />
        <buttoN type="bUTtOn" CLass="btn bTn-DefAult" ID="CanceLEdiTfiLePathMoDal" datA-DiSmIss="modaL">ANnulerEn</ButTon>
        <Input TYpe="sUbmit" cLass="btn bTn-priMAry" id="Submit" valUE="Opslaan"/>
    </div>
</foRM>

THE ReGUlar ExpRession shouLd chECk if The FILepatH Ends wIth a aLpHAnUMeric character folloWeD by / or \.
LInk to regex on Regex101.cOm
On Regex101.cOM THis seems To woRK fINe.
However when I Test tHis in my appLIcation iT seemS to never Match the eXPRession aNd tHe eRroR meSSAgE keeps showing UP.
what Am i overloOkiNg here?


Expression Validation attr ibute notworki ngcor re ctly 

Iwant to valida t e aproperty in my viewmod el to  m a tcha  r egula r expre s si o n .
V ie wm ode l: us ing S yst em.Comp onentModel .Da ta Annotations; 
n amespace P roj ectName.View Mod els
{   p u bliccla ss Vi ewMode l 
    { 
       [R e quired ( ErrorMe s s ag e ="error message.") ] 
      [Regular Expres si o n( @ " [a- zA- Z0-9][/\\] $/ img", ErrorMe s sa g e = " E nd with '/' o r '\\' char a cte r.")]     publ ic st ri n g F ilePath { g et;set; }

     publicV iewMode l()
     {

    } 
  } }
Vi e w:@model P ro je ctNam e.Vi e w M o dels .Vi ewMo del
< form asp-acti on= "Edi t Pat h" as p-con trol le r="Fi les" i d="Ed it FilePathForm">   <div asp- val id ati on -summ a ry="Mo del Onl y" clas s="text - dan ge r " > </ div>
    <div clas s= " c ol -md-5">      < di v  class=" fo rm- grou p " >
        <div c lass=" c ol -m d-12">           <labe l  asp -for=" FilePath " cla s s="control-lab e l"></label>
     < /di v>
          < divclas s =" col - md-8" >
           <input asp-f or ="File Path"  class="form- control"/>            < s pan asp-valida tion- for="FileP a th" clas s="te xt-dange r"></span >           </ div >
        <div c l a ss=" co l-md-4" >
            < p>@ Mo del.FileN ame</p>       </di v >
      </d iv >
   </ d iv>

   <d iv c la ss = "co l-md-12 te x t -rig ht "> 
     <hr / >
     <butt on type=" but t on"cl as s="btnbtn-default"id ="cancelEd it Fil ePathM o d al" data -dismiss="modal">Annule r en</but ton >
      <input t ype ="subm it" class= "btn b tn-pr im ary " id="S u b mi t"va lue="Opsla a n "/> 
   </ div> 
</form >

The regular exp r ess ion should ch eck  ift h eFil e Pa t h e nd s  wi t h  a alphanumeric  character  f o ll owed by /o r \ .Link to  Regexon Re g ex101.c om
On Reg ex101.com  t hiss e ems  to work f ine.
How ever when I tes t  t his i n m y appl ic ati on it  seems tonever  match  t he exp ressi on  and the  error message keeps sh owingup.
W hat  am I ove rlo o kin g here?

Expression Validation_attribute not_working correctly

I want to_validate a_property_in my_viewmodel_to match a_regular expression.
Viewmodel:
using System.ComponentModel.DataAnnotations;

namespace_ProjectName.ViewModels
{
   _public class ViewModel
__  {
        [Required(ErrorMessage = "error message.")]
__ ___  [RegularExpression(@"[a-zA-Z0-9][/\\]$/img", ErrorMessage =_"End with '/' or '\\'_character.")]
 _      public string_FilePath_{ get; set;_}

        public_ViewModel()
     _  {

___   _ }
    }
}

View:
@model_ProjectName.ViewModels.ViewModel
<form asp-action="EditPath" asp-controller="Files" id="EditFilePathForm">
  _ <div asp-validation-summary="ModelOnly" class="text-danger"></div>
   _<div class="col-md-5">
    _   <div class="form-group">
_ _    _  _ <div_class="col-md-12">
  _     _  _    <label asp-for="FilePath"_class="control-label"></label>
_  ___ _  __</div>
 __     __  <div class="col-md-8">
   _   __   _   <input asp-for="FilePath"_class="form-control"/>
     _ _ _      <span asp-validation-for="FilePath" class="text-danger"></span>
  _     _   </div>
_ __  __ _  <div class="col-md-4">
   _ _     _   _<p>@Model.FileName</p>
_     _     </div>
_    ___</div>
    </div>

_   <div class="col-md-12 text-right">
_  _    <hr />
 __     <button_type="button"_class="btn btn-default" id="cancelEditFilePathModal" data-dismiss="modal">Annuleren</button>
  ___   <input type="submit"_class="btn btn-primary" id="Submit" value="Opslaan"/>
  _ </div>
</form>

The regular expression should check if the FilePath_ends with a_alphanumeric character followed by /_or_\.
Link_to Regex on Regex101.com
On Regex101.com this seems to work fine.
However_when I_test this in_my application it seems to never match the expression and_the error message keeps showing up.
What am_I overlooking here?

