1 [FRIED, FRANK, HARRIS, SHRIVER & JACOBSON LETTERHEAD] EXHIBIT 5.1 January 4, 2000 Board of Directors CoStar Group, Inc. 7475 Wisconsin Avenue Bethesda, Maryland 20814 Ladies and Gentlemen: We have acted as special counsel for CoStar Group, Inc., a Delaware corporation (the "Company") and its wholly owned subsidiary, Acq Sub, Inc., a Delaware corporation ("Merger Sub"), in connection with the merger into Merger Sub of Comps.com pursuant to the Agreement and Plan of Merger, dated as of November 3, 1999 (the "Merger Agreement"), by and among the Parent, Merger Sub and the Comps.com. Under the terms of the Merger Agreement, the Company expects to issue up to 2,242,000 shares of its common stock (the "Merger Shares") to holders of common stock of Comps.com. With your permission, all assumptions and statements of reliance herein have been made without any independent investigation or verification on our part except to the extent otherwise expressly stated, and we express no opinion with respect to the subject matter or accuracy of such assumptions or items relied upon. In connection with this opinion, we have (i) investigated such questions of law, (ii) examined originals or certified, conformed or reproduction copies of such agreements, instruments, documents and records of the Company, such certificates of public officials and such other documents, and (iii) received such information from officers and representatives of the Company as we have deemed necessary or appropriate for the purposes of this opinion. In all examinations, we have assumed the legal capacity of all natural persons executing documents, the genuineness of all signatures, the authenticity of original and certified documents and the conformity to original or certified copies of all copies submitted to us as conformed or reproduction copies. As to various questions of fact relevant to the opinions expressed herein, we have relied upon, and assume the accuracy of, representations and warranties contained in the documents and certificates and oral or written statements and other information of or from representatives of the Company and others and assume compliance on the part of all parties to the documents with their covenants and agreements contained therein. Based upon the foregoing and subject to the limitations, qualifications and assumptions set forth herein, we are of the opinion that the Merger Shares registered under the Registration Statement, when issued, delivered, and paid for in accordance with 2 the terms of the Merger Agreement, will be duly authorized, legally issued, fully paid and non-assessable. The opinion expressed herein is limited to the General Corporation Law of the State of Delaware, the Delaware Constitution and reported judicial decisions interpreting those laws, each as currently in effect. We hereby consent to the filing of this opinion as an exhibit to the Registration Statement and to the reference to this firm under the caption "Legal Matters" in the Prospectus forming part of the Registration Statement. In giving such consent, we do not hereby admit that we are in the category of such persons whose consent is required under Section 7 of the Securities Act of 1933. Very truly yours, FRIED, FRANK, HARRIS, SHRIVER & JACOBSON By: /s/ ---------------------------------------------- Stephen I. Glover